Busy making things: tinycast, github, links, photos, @mc.

Extending Python for Series 60

Posted: December 23rd, 2004 | Author: | Filed under: Mobile, Python | 10 Comments »

This morning Jim pointed me to some extension modules for Series 60 Python by the Personal Distributed Information Store project. While I’m very excited to see Series 60 Python specific releases, you don’t have to go to that much trouble to get a working xml parser. There’s a perfectly good xml parser built right in to Python 2.2.2.

You’ll probably not find this written anywhere obvious, but here’s what works quite well for getting a much more complete Python environment on your Series 60 device:

  1. Grab the Python 2.2.2 source tarball.
  2. tar xzvf or do whatever it takes to decompress the file.
  3. Insert your MMC to a card reader or plug in your taco via USB.
  4. Drag the boatload of .py files and subfolders in lib to E:SYSTEMLIBS (you did install to the MMC, right?) making sure not to overwrite any existing files.
  5. Import xml.dom.minidom or whatever library you need.

I’m sure there are modules that just plain won’t work. Nokia have already included a lot of the basics (thank you thank you thank you for getting urllib working!). If the public release is anything like the pre-release software, the xml parsers and a few other things should work just fine. I spot-cheked a few examples from Dive Into Python on the prerelease and the xml-related stuff worked fine.

Update: In the comments attached to this post, effbot clarifies:

Adding the xml python package won’t help you if you don’t have an XML parser; pyexpat adds exactly that.


10 Comments on “Extending Python for Series 60”

  1. 1 Matt Croydon said at 11:34 am on December 23rd, 2004:

    Comments work now. I’ve got to deal with the url structure and old link style stuff coming in won’t have comments working :(

  2. 2 Fredrik said at 12:48 pm on December 23rd, 2004:

    Adding the xml python package won’t help you if you don’t have an XML parser; pyexpat adds exactly that.

    (note that Nokia’s samples never use the XML library; instead, they use regular expressions to parse XML…)

  3. 3 Tim said at 9:52 am on December 24th, 2004:

    xmllib has enough of a parser for xmlrpclib to work on the series 60.

  4. 4 Matt Croydon said at 10:22 am on December 24th, 2004:

    Tim: Yep, I found that out last night too and was rather dissapointed. Parsing HTML with sgmllib works, but so far no luck with xmlrpclib. It might be possible to use the expat parser linked above to make it work.

  5. 5 Fredrik said at 2:41 am on December 25th, 2004:

    xmlrpclib doesn’t depend on Python’s xml package (it falls back on xmllib if necessary). if you need DOM-like structures but no namespaces, you can use ElementTree with the SimpleXMLTreeBuilder module (which uses xmllib).

  6. 6 Extending Python for Series 60 said at 5:41 pm on June 8th, 2005: Extending Python for Series 60
    Extending Python for S…

  7. 7 Don P said at 4:24 am on August 2nd, 2005:

    Matt, I’m trying to use pyexpat on my nokia 6600 phone but it dies after looking for the library _weakref extension module.

  8. 8 Susan Skoog said at 5:47 am on August 20th, 2005:

    bowens coach travel

    Extending Python for S…

  9. 9 Payday Loans said at 1:22 pm on August 22nd, 2007:

    Payday Loans…

    adding to my bookmarks…

  10. 10 Instant Payday Loan said at 3:25 pm on August 23rd, 2007:

    Instant Payday Loan…

    cool design. i like it!