Since my mobile device is a s60v3 one (Nokia E61), I found particulary difficult to develop any simple python script on the phone. The hardest thing to do was the write - test cycle.

On linux you can't simply send the file to the phone with obex, since it will be stored in your incoming messages.

From the excellent Jürgen Scheible's tutorial website I discovered the existance of the nice putools for making easier the development cycle here

It allows you to sync and reload the scripts on the phone directly from the pc.

Unfortunately, the instructions in the website are for a windows machine, but the whole tool is python based, so it is supposed do be (and it is) multiplatform.

In the sync.config file you are asked to choose the right serial port over bluetooth file, which can be one of /dev/rfcommxx
ie: COM_PORT = '/dev/rfcomm2' instead of windows COMxx port

The first problem I had then was related to a bug of my ubuntu distribution (8.04) described here which can be easly fixed installing the bluez-utils package from Debian Sid

At this point, you can follow the instruction on the putools website by opening a serial port
$ sdptool add --channel=2 SP

$ rfcomm listen rfcomm2 2

and launching the script on the phone and finally launching from another shell the push command from the pcfiles folder.

Comments

Deuce868
nvm, got it working by changing the com port in the config from just 3 to the entire /dev... path

Thanks for the excellent post.
Deuce868
Other than the bug in the ubuntu package, any idea why I'd get the "port not open" exception?

I'm running intrepid which has the updated bluez-utils package, but wheneven I try push I get:
python push
file /home/rharding/.push/config
Connecting to serial port /dev/ttyS2
Traceback (most recent call last):
File "push", line 75, in module
main()
File "push", line 55, in main
app = App(0)
File "/usr/lib/python2.5/site-packages/wx-2.8-gtk2-unicode/wx/_core.py", line 7912, in __init__
self._BootstrapApp()
File "/usr/lib/python2.5/site-packages/wx-2.8-gtk2-unicode/wx/_core.py", line 7487, in _BootstrapApp
return _core_.PyApp__BootstrapApp(*args, **kwargs)
File "push", line 38, in OnInit
title='push' )
File "/home/rharding/Desktop/putools/pcfiles/phoneshell.py", line 56, in __init__
*args, **kwds)
File "/home/rharding/Desktop/putools/pcfiles/phoneshell.py", line 243, in __init__
*args, **kwds)
File "/home/rharding/Desktop/putools/pcfiles/btinterpreter.py", line 105, in __init__
self.bt.send( 'reset' )
File "/home/rharding/Desktop/putools/pcfiles/../libs/phcomm.py", line 339, in send
self.write( cmd )
File "/home/rharding/Desktop/putools/pcfiles/../libs/phcomm.py", line 367, in write
self.sock.send(msg)
File "/home/rharding/Desktop/putools/pcfiles/../libs/phcomm.py", line 147, in send
self.file.write( msg )
File "/usr/lib/python2.5/site-packages/serial/serialposix.py", line 328, in write
if self.fd is None: raise portNotOpenError
serial.serialutil.SerialException: Port not open