[PythonCE] How do you develop on the PocketPC?

Thomas Heller theller at python.net
Tue Jan 10 19:22:52 CET 2006


" Luke Dunstan" <coder_infidel at hotmail.com> writes:
> From: "Thomas Heller" <theller at python.net>
>> "Luke Dunstan" <coder_infidel at hotmail.com> writes:
>>> We should probably consider putting all these scripts in CVS somewhere.
>>
>> And we should probably use the pocketRapi module that Brian Brown
>> posted.
>
> I am interested to know why you prefer it. I can think of the following 
> advantages:
>
> - It initialises RAPI the first time you try to use it, and remembers this.
> - It includes more file I/O functions.
>
> I'm sure it is good for some purposes, but I can also think of some possible 
> disadvantages:
>
> - The functions are in a class instead of a module. This means that you 
> could create multiple instances of the class, which doesn't make sense.
> - The name "pocketRapi" implies Pocket PC only but RAPI really applies to 
> Windows CE in general.
> - It requires win32file.
> - The file I/O functions do not follow the pattern of Python file objects.
> - It doesn't include the last error codes in exceptions raised.
> - It doesn't use "argtypes" or "restype". I don't know if this makes it 
> faster?
> - Redistributions in "binary form" must reproduce the copyright notice.

I must say I didn't look at the module, but assumed that it wrapped a
large amount of the rapi functions, so I wanted to avoid reinventing
this particular wheel.  Same for the license, I didn't look at it.

If I were to commit these scripts somewhere, and add a ctypes-based rapi
module, I would most certainly like to take responsibility for the rapi
code anyway.  Hopefully that would be a good thing, but in the version
that I have there are only a couple of lines like this:

ctypes.oledll.rapi.CeRapiInit()
res = ctypes.windll.rapi.CeCreateProcess(unicode(REMOTE_EXE),
                                         unicode(REMOTE_CLIENT),
                                         None, None,
                                         False, 0, None, None,
                                         None, None)
if res == 0:
    raise ctypes.WinError(ctypes.windll.rapi.CeRapiGetError() or \
                          ctypes.windll.rapi.CeGetLastError())
[...]
try:
    [....]
finally:
    ctypes.oledll.rapi.CeRapiUninit()

Not very reusable.

To answer your question about 'argtypes' and 'restypes':
Not setting argtypes may gain a little bt of speed, but the big
advantage of using 'argtypes' would be the auto-string/unicode
conversion that ctypes does (which is also missing in my own code).

Sorry,

Thomas



More information about the PythonCE mailing list