All Things Pythonic

Too Much Fun with Python on Nokia Phone

by Guido van van Rossum

February 14, 2006



Summary

Nokia gave me a phone to run Python. I wish I could blog all night about it! The phone is great, but the really cool part is how much effort Nokia has put in opening up the functionality to Python programmers! A tip of the iceberg.


Full disclaimer: Every once in a while I get a boondoggle out of being Python's BDFL. The most recent is a model 6630 phone that Nokia gave me as an early Valentine. So my review cannot be considered objective -- be warned!

I don't quite know where to start. The phone itself, even without Python, is incredibly cool; I spent much of the weekend using it as a camera, and it worked remarkably well considering that it doesn't have an optical zoom or a flash, and is "only" 1.3 megapixels.

The phone came with a cable to connect it to USB port, and a CD full of software - Windows only. I guess this means I can sync it to Outlook or so. But I don't use that any more. On my Mac, plugging in the USB cable doesn't seem to do anything, and there's no Mac software on the CD, but guess what: iSync supports this phone over Bluetooth (with the right icon and all!). And they don't even sell this model in the US. Great job, Apple!

Next, Python. I still haven't written any significant Python code for the phone, but I've explored Nokia's examples a bit and walked through most of the MobiLenin.com tutorial (see previous blog).

When writing Python code for a phone, of course the first obstacle is, how to write code? You don't really want to edit your code on the phone's numeric keyboard! Fortunately there's a way to connect a PC or Mac to the phone over Bluetooth, and the Python application on the phone supports interactive sessions this way (as well as an interactive session on the phone's own screen -- with 11 lines of about 20 characters each not very attractive beyond "print 2*2", but essential for mini-demos in Google's hallways). Thanks to Eric Smartt's blog for giving me the hint I needed to get this working on the Mac.

So on to the vast array of APIs available. Nokia has really done an outstanding job here. There are extension modules that handle all of the phone's devices: dial a call, snap a picture, send/receive SMS, Bluetooth, and Internet (if your service provider offers it of course); as well as the key applications (calendar and address book, and probably more that I haven't even discovered). You can also play sounds, view images, draw into a canvas, or open any file that the phone understands natively. And of course the GUI library -- menus, dialogs, a low-level event loop, etc. Stuff for which standard Python libraries exist generally uses those -- the filesystem (ROM, RAM, memory card, flash) of course, but also the Internet -- urllib "Just Works" (TM), and you can even write a server if you want to (your service provider will probably love it: I signed up with Cingular which charges a penny per kilobyte -- what a rip-off).

Anyway, gotta run (sleep, more like it :-). I just had to put this out. Oh, there are lots of resource pointers on the MobiLenin.com intro and resources pages. Thanks Jürgen Scheible!!!

Talk Back!

Have an opinion? Readers have already posted 10 comments about this weblog entry. Why not add yours?

RSS Feed

If you'd like to be notified whenever Guido van van Rossum adds a new entry to his weblog, subscribe to his RSS feed.

About the Blogger

Guido van Rossum is the creator of Python, one of the major programming languages on and off the web. The Python community refers to him as the BDFL (Benevolent Dictator For Life), a title straight from a Monty Python skit. He moved from the Netherlands to the USA in 1995, where he met his wife. Until July 2003 they lived in the northern Virginia suburbs of Washington, DC with their son Orlijn, who was born in 2001. They then moved to Silicon Valley where Guido now works for Google (spending 50% of his time on Python!).

This weblog entry is Copyright © 2006 Guido van van Rossum. All rights reserved.