[PythonCE] A PythonCE package

Ed Blake kitsune_e at yahoo.com
Mon Jul 4 07:46:18 CEST 2005


I've created a kind of PythonCE package.  It is the zip file from the lib dir
with a few extra things add.  Namely the Twisted framework and xml support. 
Links to downloads are at the bottom, and an explanation of methods and
motivations follows:

I've been playing around with network stuff recently and I've been reading
about the Twisted framework on my PocketPC.  While I was reading though I
would get ideas for tests or ways to use the code in the examples.  The
problem was I couldn't run this stuff on my PPC because I didn't have Twisted
available.

Now for some reason I thought Twisted had some pre-compiled bits buried
somewhere in it.  So I opened up my laptop and did some poking around to see
if there were any pyd files or such.  But it seems that Twisted is indeed
pure Python!  So I grabbed the Twisted folder out of site-packages, cleaned
out all the pyc/pyo files to save space, and threw it into my PythonCE lib
directory.  I know keeping the pycs would probably have been faster and
smaller but oh-well.  So I run the Python interpreter and try from
twisted.internet import reactor, and after a longish loading time the import
passed without an error.  Next I tried from twisted.internet.protocol import
Protocol, and this time there was virtually no delay in loading.

Now the problem with Twisted as you may have guessed is that it's big.  In
fact after I stripped out all the py* files it was still about 7Mb on disk. 
Luckily in Python 2.3 you can import modules from a zip archive.  That is
what the python23.zip is in your PythonCE lib folder.  So I copied the zip
onto my desktop and I copied the twisted folder into that.  While I was
playing Frankenstein I also copied everything in the _xmlplus folder into the
xml folder I found there.  I saved a backup of my Python23.zip and then
copied my new version over the one on my PPC.  To my mild surprise I was
still able to import and use both Twisted and xml after this.  These big
libraries though take up more space then just their size on disk.  Twisted
zipped takes about 1.5Mb, Python plus twisted.internet.reactor plus
xml.dom.minidom take nearly 6Mb of ram when running.  So, unless your writing
a pocket sized web server, socket and socketServer are probably your best bet
for network programs.

Some Links:

My python bundle:
http://kitsu.petesdomain.com/files/WinCE/python23.zip
provided 'as is' without warranty of any kind, either express or implied etc.

A nice blog:
http://blogs.unixage.com/blojsom/blog/adam.kruszewski/python
This is where I found the working xml module. (scroll down)

I am also hosting the xml module as well as other interesting stuff because
cool PythonCE stuff tends to vanish:
http://kitsu.petesdomain.com/files/WinCE/


More information about the PythonCE mailing list