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.
Advertisement
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!!!
I enjoy having wireless Bluetooth. It connects fairly well to my Linux box, but be aware that it quickly drains the batteries even when not engaged. I have to keep Bluetooth turned off to have any useful time left on the phone.
I've had a good time playing with Python on my 6630 too, although it was occasionally frustrating going back to 2.2isms. (And now I'm phone buddies with the BDFL!)
I built a small application that allows you to read long text files (such as cleaned-up files from Project Gutenberg). It remembers where you're up to, and can save and jump to named bookmarks, as well as loading the file in chunks to avoid using up too much memory. It's convenient for reading on the Tube, although the screen's obviously too small and it tends to use the battery up much faster than usual. If anyone's interested, I'll clean it up and post it to a snippet website.
Christian, please share it. I would like to have an easy-to-use e-book like program (in pys60 so I can customize it). I was thinking of writing an e-book reader myself. However, it may be too big a project for me.
I bought a 6600 a year or so ago, and while I haven't really done much actual phone-specific programming, having a general purpose programming language available on the phone is very nice. I've used it a few times in math classes - it's cool to be able to compute numerical solutions to differential equations with your cell phone. :)
> Fortunately there's a way to connect a PC or Mac to the > e 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).
Using IP over Bluetooth (PPP daemon and routing enabled on the PC or Mac) you can have interactive console to your workstation over TCP connection (there was a small example of this in the pys60 docs).
The benefit of this is that you'll then have Internet connectivity available all the time for the app your debugging/developing.
I wish I could stand up at a large python meeting and beg all developers to stop hacking away at their servers and take a good look at their mobile phone. :) The inherent constraints of mobile terminals offer way more 'challenges' for python hackers than servers with their 1gbit connections, 2gbyte working memory and 1 terabyte harddisks. (I'm luring them here :) At least I'm glad that you're giving 'mad props' to the pys60 effort.
Although I agree that Nokia did, and does, a phenomenal job, I also think the effort is not enough. The traffic on Nokia's 'python for series 60' (pys60) discussion board is pretty low and the number of issues with the implementation is also problematic. The problem is that pys60 is a niche since it's for a very limited range of mobile terminals. The real challenge is getting it working on most of the current mobile phones. That's comparable to getting regular python running on 200 different architectures and operating systems. Imagine that.
You should compare pys60 with Java and, sorry, Windows Mobile to understand its position in the current market.
Although this may sound somewhat negative, I'm really happy with Nokia's effort (and your attention for their project). I'm using it to build real world applications that cannot be built using java or windows mobile, and that's pretty cool. I just hope that the python community at large will take a long hard look at this new arena to get inspired and jump in, else the project is doomed for a life in the shadow of lesser technologies.
I just ordered a 6682 today and I can't wait to hack away at it. Guido, you should switch to the unlimited MediaNet plan from cingular. It is $20 a month and the only thing you can't do is use the phone for laptop tethering. However, their is much debate over at the Cingular forums about wether you can get away with the tethering or not. Most people are getting away with it. Hope that helps