Python for Symbian OS

Python for UIQ *Preview*

Now including Python for Series 80

Project Info

This is my independent attempt to port Python to Symbian OS devices. It is a new port from the generic Python 2.3.3 sources. It does not contain any code from my Amiga port of Python. The Python interpreter works in console mode, and most of the standard library modules work as expected. But a lot more work is needed to really allow people to program their phones in Python.

Updated: 19th July 2005

The Python for Series 80 build is currently unavailable.

For those of you visiting from, sorry to disappoint, but I didn't ask or authorize them to make any announcement about this alpha build, and am not very happy about the fact that they did so..

Although working on the emulator, the same code built for the target devices has now been verified as not working. I may at some point release the emulator build.

Currently, the Python interpreter runs and you can interactively enter Python programs or code fragments. Many of the test modules run successfully, including zip, which is linked against EZlib, however, there is not yet support for modules such as socket, bzip2 or pyexpat.

New in latest release

17th August 2004:

  • SIS installer
    • With the exception of, all Python Standard Library modules are in precompiled .pyc format, and zipped up, to reduce the memory footprint of the target version
      • Performance may be impacted by using zipimport but I think the space saving is worth it
    • N.B. it will place the zipped Python standard library in C:\Lib\ and needs about 1MB to store
    • The Python.exe will be in \System\Programs on the device you specified. You will need a file manager like QFileMan or SMan to run it.
    • This version reportedly works with infrared keyboards. It may also work with the P910 keyboard.
  • Small distribution of source patches
    • Place the unzipped contents in the root of Python-2.3.3
    • The diffs file can be used with the standard patch command to apply the needed changes. N.B. it expects to put the changed files into /cygdrive/e/source/ which is where it lives on my computer, using Cygwin. If applying patches to somewhere else, edit the diffs file in a text editor first, with a global find and replace.
    • I might have got the diffs backwards, but patch can normally cope with that
    • Work from the Python-2.3.3\Symbian directory - here you will find the MMP file and bld.inf
  • Support for command line only WINS builds
  • The definitive build file is now the Python.mmp file
    • The CodeWarrior Python.mcp file will need to be freshly imported if you really want to use CodeWarrior
  • Started branching a new symbian module from the generic posix module. Now recognises it is symbian module, and uses ntpath instead of posixpath as Symbian OS uses FAT filesystems.
  • The following didn't quite make it into this release, but are not far away
    • compressed Python.exe using ECompXL. I had it working fine, and it compressed Python.exe down to 350K from 900K, but after a reboot, now it's not working. The paths are all OK, so I'll put it down to Windows having an off day, and try again later in the week.
    • Update to Python 2.3.4. Now that I've made the Symbian diffs, it should be easy enough to upgrade, since nothing that I touch has been changed.
  • Known bugs
    • You may occassionally get a bad marshal data error, for no apparent reason
  • Check my RSS feed for updates


  • PythonUIQ.SIS - installer for all UIQ phones. Only tested on P800. Needs some kind of keyboard device to be truly useful. In order to quit this app, close your flip, open again and then use a program like Switcher to kill it. (Use "Save Target As..." if your browser doesn't know about .SIS files, I'm afraid my ISP doesn't).
  • (Current offline) PythonS80.SIS - installer for Series 80 version 2 phones (currently Nokia 9300 and 9500). Not tested! Please send feedback if whether you get this working or not.
  • - diffs and Symbian specific files. Unpack into the root of your Python-2.3.3 folder

Sponsored by Symbian experts Symsource - consulting, training and technical support for all Symbian OS engineering projects.

Project Plan

To help you keep track of the project and progress, I created this little progress tracker so you can see what I have planned and how long you'll have to wait for it, bearing in mind I barely have two evenings a month to work on this. If Nokia end up open sourcing their Series 60 port, then the scheduling of this could be changed or brought forward, as I'd like to re-use their work if they'll let me.

  • Initial source code only release [Complete]
  • Device build for Python developers with IR keyboards* [Complete]
  • Socket module working [Days]
  • Self-decompressing executable made using ECompXL [Days]
  • Script launcher UI with UI-friendly console i/o [Weeks]
  • .py MIME type recognizer [Weeks]
  • Server architecture to prevent need for multiple instances of the interpreter to take up memory [Weeks]
  • Series 60 build [Weeks] Other platforms if requested e.g. Series 80
  • Agenda and Contacts modules [Months]
  • Bluetooth module [Months]
  • Dynamic loading of C modules [Months]
  • GUI library [Months]
  • Application packager [Months]
  • UI scripting, ala AppleScript [Years]

* I'm told console mode works fine with Pocketop keyboards using the driver here. It may also work with the P910 QWERTY keypad. If anyone feels like sending me one to test with, you'd be very welcome! ;-)


Python running in Console mode on the UIQ 2.1 emulator

Python running in Console mode on the UIQ 2.1 emulator


I think that the perfect Symbian OS port of Python would have the following features: -

  • Client-Server design - at least until dynamic loading of C modules is done, it doesn't seem too practical to have multiple instances of the interpreter running for each script, and there is too much global data in the exe to conveniently convert it into a DLL (I am working on this approach in parallel with my Amiga port as well)
  • Reduced Python Standard Library, missing modules not necessary on a lightweight, non UNIX, non server device
  • Move to Python 2.3.4 and future versions as necessary
  • Dynamic loading of C/C++ modules
  • Modules for mobile phone functionality (Bluetooth, PIM, Telephony, UI scripting ala AppleScript)
  • Hopefully some kind of UI library, whether it will be some kind of tkinter/wxPython or a Symbian specific module remains to be seen
  • Provide a solution to allow applications to host a "Python port" so that they can be scripted ala ARexx or possibly use the same OPX files that the OPL language uses
  • Script launcher including .py recognizer, starting scripts on request, at specific times, on startup or on certain events, such as new SMS received.
  • Package maker, to allow Python scripts to appear as standard Symbian OS apps in the Launcher and be distributed in .SIS files.
  • Distribution in minimal form (e.g. zipped, precompiled modules only, no online help) for devices and separate developer's distribution for emulator environment.

Why Python?

Since seeing the power of ARexx on the Amiga, years ago, I regard it as essential to have an easy to use, powerful language to links otherwise independent parts of a computer system together. Python is modern, well supported, free, portable, lean (in the sense that one doesn't have to worry about anything other than writing their program) and powerful. In fact, despite being labelled as a scripting language, Python is a pretty good all rounder, and it fits neatly in between the complex Symbian OS C++ and the under powered Java J2ME MIDP. I think it has the potential to become the most widely used non-systems high level language one day, used for everything from applications to server admin to teaching programming (about time kids stopped starting with BASIC eh?).

Imagine the following applications of having an easilt script-able mobile phone:

  • Automatically download news headlines, weather, travel news and TV guide processed into a single HTML page that is ready and open just as you wake up in the morning
  • Search eBay or Amazon or Google or directly through their web APIs, without the overhead and cost of using the web browser - this is what makes a micro-browser
  • Have your phone set itself to silent, and your IM software presence info to busy, automatically if your diary says you are in a event classified as a meeting or containing certain keywords
  • Reply to SMSes for you when you are busy
  • Automate logging the position of base stations relative to GPS coordinates to a server, so that non GPS enabled devices can tell roughly where they are just by the base station's identity
  • ...and many more

Supported Devices

  • SonyEricsson P800 - this will be first because it's the only one I have and use
  • Other UIQ devices - will be supported if possible
  • Other Symbian OS devices - the console version already builds for other devices, including Series 90, 80 and Series 60 version 1. That will break when I start putting in platform specific code. For now, my preference is to support UIQ as I prefer that kind of device.


This software (the delta between this port of Python for Symbian OS, and the generic Python distribution) is distributed under the following plain english license terms (no legalese here), which are as follows: -

  1. The license starts here.
  2. The Software being licensed is "Tim Ocock's Python for Symbian OS" and includes any source code, executable code, documentation, designs and APIs.
  3. The Software may be downloaded from here and used by anyone for any purpose free of charge, other than as restricted by the terms of this license.
  4. The Software may not be redistributed. This applies to all re-distribution, whether as-is or in any modified form, including incorporation with other products, both and free and commercial.
  5. The Software does not carry any warranty or indemnity. All use is at your own personal risk.
  6. By downloading, copying or using the Software you accept the terms of this license.
  7. This is the end of the license.

You may query why redistribution is not allowed - note that Python is not GPL so there are no requirements to allow it. Indeed, there is a precedent for restricting redistribution - the main Windows port, ActiveState's ActivePython also uses this model. If you are contributing, we can discuss this.

Python Links