How to write a python for Series 60 script and test it

Writing a script:


1. Use a text editor on Mac or PC to write your python script (useful editors are e.g. Pywin or ConTEXT, but also notepad works). Sometimes it is useful to start with some existing skeleton code. script_example.py

2. Save your script as *.py (for python)




Testing your script: (4 options)


A) Testing the script on the phone:
2nd editon phones:
1. Push your *.py script to your phone via Bluetooth or PC suite (goes to the message inbox)
2. Open the received message and install it as "Python script" (message handler recognises python files and starts the python installer)
3. Start the PyS60 interpreter application on your phone (snake icon) -> press "options" -> select "Run script" -> select "your script" and press ok (your script should now start up)

3rd editon phones:
Note: on 3rd ed. phones pushing your *.py script to your inbox via Bluetooth doesn't work. Instead you need to create a folder named 'Python' to your e: drive (memory card) from where the PyS60 interpreter picks them automatically for execution.
1. Move your *.py scripts from your PC to that 'Python' folder using the USB cable or Nokia PC Suite
2. Start the PyS60 interpreter application on your phone (snake icon) -> press "options" -> select "Run script" -> select "your script" and press ok (your script should now start up)


B) Testing the script with the emulator on PC
* Install Series 60 Developer Platform SDK (includes Emulator). Install "python plug-in" files from „PythonForSeries60_SDK_..._.zip“ (PyS60 download site) into a specific folder (check documentation).
* Load your script into the Emulator (copying your *,py file to a specific folder) for testing on emulator. Open the python application via the "snake" icon on the emulator and run your script.

C) Using the bluetooth console:
The bluetooth console lets you use the python command line on the PC where as the phone actually executes the commands. To get this set up you need to do the following:

1. Open e.g. a hyper terminal on the PC (make sure you have bluetooth on your PC switched on and a valid COM port is selected when setting up the hyper terminal. More info) Note: for Mac this description is not valid, but you can use a similar setup with the Mac as well.

2. Run the python interpreter application on your phone (snake icon) -> press "options" -> select "Bluetooth console " and press ok. Now a bluetooth connection should be setup and the python command line appears in the hyper terminal.

D) Using file sync from PC to phone:
Kari Pulli from Nokia / MIT Boston has made some tools that allow to sync your files from PC to the phone, so no need for pushing files via BT to the phone anymore. The thing here is, it uses PySerial on the PC side. Download the relevant tools and instructions on how to do the install and do the setup from here: http://people.csail.mit.edu/kapu/symbian/python.html.

 

 

 

Menu     Copyright (c) 2007 Jurgen Scheible