Friday, April 27, 2007

S60 Python (pys60) vs Python

Although pys60 provides a nice Python environment for phones, there are some small discrepancies to watch out for.

1) Different packages: e32 and graphics are available on the phone only. So you'll have to test on the device. You can check which OS the script is running on:

import os
if os.name == 'posix': # OS X/Linux
path += "/"
elif os.name == 'e32': # Symbian
path += "\\"

2) thread.start_new_thread() seems to freeze the v1.2 and v1.3.21 interpreter on the N95. The sample RssReader in the docs does use threading, so I'm not sure why it doesn't work for me.

3) sleep(): "In python for series 60, the use of e32.ao_sleep is encourage over time.sleep. AO stands for 'Active Object' approach to cooperative multi-tasking. When an object go to 'ao_sleep' other active objects can run."
 import e32
e32.ao_sleep(5) # sleep for 5 seconds


No comments: