The Artima Developer Community
Sponsored Link

Weblogs Forum
Too Much Fun with Python on Nokia Phone

10 replies on 1 page. Most recent reply: Mar 2, 2006 12:29 AM by Korakot Chaovavanich

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 10 replies on 1 page
Guido van van Rossum

Posts: 359
Nickname: guido
Registered: Apr, 2003

Too Much Fun with Python on Nokia Phone (View in Weblogs)
Posted: Feb 14, 2006 1:32 AM
Reply to this message Reply
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!!!


Korakot Chaovavanich

Posts: 6
Nickname: korakot
Registered: Aug, 2005

Re: Too Much Fun with Python on Nokia Phone Posted: Feb 14, 2006 4:35 AM
Reply to this message Reply
I have written some fun snippets here.

http://www.bigbold.com/snippets/tags/series60

One of them you have seen, it's M'Clock
http://www.bigbold.com/snippets/posts/show/571

Hope you like these snippets.

Jeff Bauer

Posts: 3
Nickname: rubic
Registered: Nov, 2005

Re: Too Much Fun with Python on Nokia Phone Posted: Feb 14, 2006 9:42 AM
Reply to this message Reply
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.

Christian Muirhead

Posts: 3
Nickname: xtian999
Registered: Feb, 2006

Re: Too Much Fun with Python on Nokia Phone Posted: Feb 14, 2006 10:34 AM
Reply to this message Reply
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.

Korakot Chaovavanich

Posts: 6
Nickname: korakot
Registered: Aug, 2005

Re: Too Much Fun with Python on Nokia Phone Posted: Feb 14, 2006 11:19 AM
Reply to this message Reply
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.

Alan McIntyre

Posts: 2
Nickname: amcintyre
Registered: Feb, 2006

Re: Too Much Fun with Python on Nokia Phone Posted: Feb 15, 2006 2:02 AM
Reply to this message Reply
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. :)

Tero Saarni

Posts: 4
Nickname: tsaarni
Registered: Feb, 2006

Re: Too Much Fun with Python on Nokia Phone Posted: Feb 15, 2006 3:49 AM
Reply to this message Reply
> 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 have a small program I did last year to take benefit of this: http://kotisivu.mtv3.fi/terosaarni/python/consoletools/

--
Tero

Berco Beute

Posts: 72
Nickname: berco
Registered: Jan, 2002

Re: Too Much Fun with Python on Nokia Phone Posted: Feb 17, 2006 4:21 PM
Reply to this message Reply
Great to hear you're 'getting' it as well. Python on mobile terminals is where Python's future is (I mentioned it here before: http://www.artima.com/forums/flat.jsp?forum=106&thread=140672

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.

Keep up the good work!
Berco

Christian Muirhead

Posts: 3
Nickname: xtian999
Registered: Feb, 2006

Re: Too Much Fun with Python on Nokia Phone Posted: Feb 19, 2006 8:49 AM
Reply to this message Reply
Hi Korakot - I've uploaded my app to www.toysinabag.com. I hope it's useful - it's very simple!

Derek Basch

Posts: 1
Nickname: dbasch
Registered: Feb, 2006

Re: Too Much Fun with Python on Nokia Phone Posted: Feb 24, 2006 2:22 AM
Reply to this message Reply
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

Korakot Chaovavanich

Posts: 6
Nickname: korakot
Registered: Aug, 2005

Re: Too Much Fun with Python on Nokia Phone Posted: Mar 2, 2006 12:29 AM
Reply to this message Reply
Thanks! Christian.

I will see if I can modify it or suggest a feature.
Do you think a rich text (e.g. color) feature would be useful?

Flat View: This topic has 10 replies on 1 page
Topic: Are There No Decent Mailing List Programs? Previous Topic   Next Topic Topic: Sorry About the Downtime


Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2014 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us