installer question
Target audience is little or no programming experience. I have a win32 only library I need to write an installer for. As part of the installation it must: 1.. find where a program is installed 2.. copy a file to the directory 3.. add the directory to the pythonpath and change a ini file. 4.. add a example directory at a user selected path.As well as add this to pythonpath. 5.. Add the main library to site packages. There is also a package of examples which need to be independently upgradable and located in the main directory. Suggestions? I'm thinking disutils would make for the easiest method but as far as I can see you can't run a script on finishing the installation or get the user to select from a directory. Nor does it seem contain methods to find windows programs without downloading pythonwin32 as well. For the examples, NSIS or equivalent looks to be what I need but overly complicated. Can you combine NSIS and disutils? Or should I just use NSIS without disutils. Advice appreciated. The first time I've released software before ;-) Guy -- http://mail.python.org/mailman/listinfo/python-list
getting a class attribute using a keyword argument
Hello, I have a list of class instances. I wish to get the appropriate class attribute in each class instance depending on a SINGLE keyword in the calling class. How do I get the calling method to correctly recognise the keyword as a keyword and not a class attribute? See example code below (which doesn't work). class tocall: def __init__(self): self.title = "test" self.name = "name" def callingmethod(self,**kw): for key in kw: if tocall.key == kw[key]: return tocall.key which should work as such(but doesn't): print callmethod(title = "test") print callmethod(name = "name") Regards, Guy -- http://mail.python.org/mailman/listinfo/python-list
howto load and unload a module
Hello, I have a directory of python scripts that all (should) contain a number of attributes and methods of the same name. I need to import each module, test for these items and unload the module. I have 2 questions. 1.. How do unload an imported module? 2.. how do I test for the existance of a method in a module without running it? TIA, Guy -- http://mail.python.org/mailman/listinfo/python-list
Re: howto load and unload a module
> > Why would you want to? Doing what you describe doesn't require that you > "unload" a module, unless that means something more to you than, say, > merely releasing the memory used by it (which is likely insignificant to > you). > Hi Peter, I have an application with Python embedded. I'm parsing a script directory to build a dictionary of script names with descriptions of what the scripts etc extracted from each script. The user then selects one of these scripts to execute by the embedded python. Some of these scripts could potentially be quite large. Also the list of scripts could be quite large. So the main reason for unloading modules is to save memory. Regards, Guy -- http://mail.python.org/mailman/listinfo/python-list
Re: howto load and unload a module
> BTW, question for the OP: what on earth is the use-case for this? Bulk > checking of scripts written by students? > > Cheers, > John I've embedded python in an application which has a .NET API. So users can write scripts in python that access the .NET API. Because of the way the API works running scripts is a 2 stage process. First you select a script from a list then run the selected script. All scripts must therefore share a common calling function name and I wanted to test this function existed. I will have no idea the name or how many or how complicated the scripts will be so it seemed a good idea to try and free up memory from the scripts that won't be run. >(It's hard to judge a poster's level of expertise in Python without any example >code from him. I'm not a professional programmer so my terminology is probably confusing.It looks like I shouldn't worry about memory issues. Thanks for your help Peter and John, Guy -- http://mail.python.org/mailman/listinfo/python-list
Re: python for microcontrollers
How about just helping this project: http://pyastra.sourceforge.net/ I know he's trying to rewrite it to work across multiple uC's (AVR,msp430 etc) HTH, Guy Evil Bastard wrote: > Hi all, > > I'm currently tackling the problem of implementing a python to assembler > compiler for PIC 18Fxxx microcontrollers, and thought I'd open it up > publicly for suggestions before I embed too many mistakes in the > implementation. > > The easy part is getting the ast, via compiler.ast. Also easy is > generating the code, once the data models are worked out. > > The hard part is mapping from the abundant high-level python reality to > the sparse 8-bit microcontroller reality. > > I looked at pyastra, but it has fatal problems for my situation: > - no backend for 18fxxx devices > - only 8-bit ints supported > > I'm presently ripping some parts from the runtime engine of a forth > compiler I wrote earlier, to add support for 8-32 bit ints, floats, and > a dual-stack environment that offers comfortable support for local > variables/function parameters, as well as support for simpler and more > compact code generation. > > Python is all about implicitly and dynamically creating/destroying > arbitrarily typed objects from a heap. I've got a very compact > malloc/free, and could cook up a refcounting scheme, but using this for > core types like ints would destroy performance, on a chip that's already > struggling to do 10 mips. > > The best idea I've come up with so far is to use a convention of > identifier endings to specify type, eg: > - foo_i16 - signed 16-bit > - foo_u32 - unsigned 32-bit > - bar_f - 24-bit float > - blah - if an identifier doesn't have a 'magic ending', it will > be deemed to be signed 16-bit > > also, some virtual functions uint16(), int16(), uint32(), int32(), > float() etc, which work similar to C casting and type conversion, so I > don't have to struggle with type inference at compile time. > > Yes, this approach sucks. But can anyone offer any suggestions which > suck less? > -- http://mail.python.org/mailman/listinfo/python-list
Python COM API binding job offer
Hello, I have an API I have tried to create a python binding to. It involves creating com server functions which are then registered with the parent application. I am not a professional programmer nor do I have much win programming knowledge. As such what I am wanting to do is pay someone to download the parent application and API documentation then attempt to get to first base for me and provide a proof of concept. You would need to have good python, COM knowledge. I'm agnostic as to it being a win32com or a ctypes binding. The API is from a large multinational Company.And the API is not public so the person would have to sign an NDA. My understanding is the eventual license for the API will be open so my intention is to put the python binding (if it's working) out for public consumption if it can be made to work. If anyone is interested please contact me off list. [EMAIL PROTECTED] Regards, Guy Robinson -- http://mail.python.org/mailman/listinfo/python-list
creating .NET clients with python
Hello, Can anyone confirm if there is a python library that can allow me to create .NET clients in python. My understanding is both IronPython and python for .NET can't create python .net clients? Regards, Guy -- http://mail.python.org/mailman/listinfo/python-list
Re: creating .NET clients with python
Thanks Alan, Are you saying I can create python .net clients with PythonNet. My understanding is I can only use .net clients from python not the other way around. Do you have an example showing creating a .net client in python? regards, Guy yaipa wrote: Guy, I can tell you that pythonNet is quite far along, rel 1, Beta 4 actually. here is a c.l.p link to the three major releases. http://groups-beta.google.com/group/comp.lang.python/browse_frm/thread/ddfc68767901007c/445f2052948d93e2?q=pythonnet&_done=%2Fgroup%2Fcomp.lang.python%2Fsearch%3Fgroup%3Dcomp.lang.python%26q%3Dpythonnet%26qt_g%3D1%26searchnow%3DSearch+this+group%26&_doneTitle=Back+to+Search&&d#445f2052948d93e2 Cheers, --Alan Guy Robinson wrote: Hello, Can anyone confirm if there is a python library that can allow me to create .NET clients in python. My understanding is both IronPython and python for .NET can't create python .net clients? Regards, Guy -- http://mail.python.org/mailman/listinfo/python-list
Re: [Python.NET] Announce: Python for .NET 1.0 RC1 released
Great Stuff!!! >(probably including a few specific > examples of embedding Python for .NET in a .NET application). Cool!! :-) Guy Brian Lloyd wrote: > Hi all - > > I'm happy to announce the release of Python for .NET 1.0 RC1. > You can download it from: > > http://www.zope.org/Members/Brian/PythonNet > > Highlights of this release: > > - Implemented a workaround for the fact that exceptions cannot be > new-style > classes in the CPython interpreter. Managed exceptions can now be > raised > and caught naturally from Python > > - Implemented support for invoking methods with out and ref parameters. > Because there is no real equivalent to these in Python, methods that > have out or ref parameters will return a tuple. The tuple will contain > the result of the method as its first item, followed by out parameter > values in the order of their declaration in the method signature. > > - Fixed a refcount problem that caused a crash when CLR was imported in > an existing installed Python interpreter. > > - Added an automatic conversion from Python strings to byte[]. This > makes > it easier to pass byte[] data to managed methods (or set properties, > etc.) as a Python string without having to write explicit conversion > code. Also works for sbyte arrays. Note that byte and sbyte arrays > returned from managed methods or obtained from properties or fields > do *not* get converted to Python strings - they remain instances of > Byte[] or SByte[]. > > - Added conversion of generic Python sequences to object arrays when > appropriate (thanks to Mackenzie Straight for the patch). > > - Added a bit of cautionary documentation for embedders, focused on > correct handling of the Python global interpreter lock from managed > code for code that calls into Python. > > - PyObject.FromManagedObject now correctly returns the Python None > object > if the input is a null reference. Also added a new AsManagedObject > method to PyObject, making it easier to convert a Python-wrapped > managed > object to the real managed object. > > - Created a simple installer for windows platforms. > > > All known bugs have also been fixed - thanks to all who have sent in issue > reports and patches for past releases. > > At this point, the only thing I plan to do before a 1.0 final is fix any > new issues and add to the documentation (probably including a few specific > examples of embedding Python for .NET in a .NET application). > > Enjoy! ;) > > > Brian Lloyd[EMAIL PROTECTED] > V.P. Engineering 540.361.1716 > Zope Corporation http://www.zope.com > -- Robinson eDesign,P/F: +64 7 866 0626 Rings Beach, M: 021 238 0839 -ltd coverage RD2, E: [EMAIL PROTECTED] Whitianga. New Zealand -- http://mail.python.org/mailman/listinfo/python-list
