PyS60: PUTools, Advanced Python Console From Your Nokia Phone on Your Mac (OSX 10.4 Tiger)
by notpeter in Workshop > Tools
5479 Views, 1 Favorites, 0 Comments
PyS60: PUTools, Advanced Python Console From Your Nokia Phone on Your Mac (OSX 10.4 Tiger)
Use PUTools to connect to give your phone from your mac giving you an advanced bluetooth console with syntax highlight, auto file syncronization, etc.
Start by completeling the steps in this instructable to setup a simple bluetooth console.
I did it on my Nokia E70, but it should work equally well for all S60v2 and S60v3 phones as well. (E50, E60, E61, E62, E70, E90, n70, n80, n95, 6820, 6822, etc)
View this instructable on all one page it's easier to see that way.
Start by completeling the steps in this instructable to setup a simple bluetooth console.
I did it on my Nokia E70, but it should work equally well for all S60v2 and S60v3 phones as well. (E50, E60, E61, E62, E70, E90, n70, n80, n95, 6820, 6822, etc)
View this instructable on all one page it's easier to see that way.
Setup and Test the Basic Console.
Setup a basic Python console over bluetooth.
Follow my other instructable: PyS60: Python console from your Nokia phone on your Mac.
Make sure the simple console is working, cause if it doesn't, this won't work either.
Once you have that working, continue to the next step.
Follow my other instructable: PyS60: Python console from your Nokia phone on your Mac.
Make sure the simple console is working, cause if it doesn't, this won't work either.
Once you have that working, continue to the next step.
Install Python and Related Prerequisites on Your Mac
Download/update Python:
Download and install Python 2.5 from the Python.org download page (I used Python 2.5.1 python-2.5.1-macosx.dmg
Download and install the Unicode OSX build of wxPython for Python 2.5 from the wxPython download page (I used wxPython2.8-osx-unicode-2.8.4.2-universal-py2.5.dmg).
Download pySerial from the PySeial SourceForge download page (I downloaded pyserial-2.2.zip).
Extract pyserial-2.2.zip.
Open terminal and go into the pyserial directory.
Run "python setup.py install" (see screenshot).
Download and install Python 2.5 from the Python.org download page (I used Python 2.5.1 python-2.5.1-macosx.dmg
Download and install the Unicode OSX build of wxPython for Python 2.5 from the wxPython download page (I used wxPython2.8-osx-unicode-2.8.4.2-universal-py2.5.dmg).
Download pySerial from the PySeial SourceForge download page (I downloaded pyserial-2.2.zip).
Extract pyserial-2.2.zip.
Open terminal and go into the pyserial directory.
Run "python setup.py install" (see screenshot).
Download and Modify PUTools
Download PUTools. (I downloaded putools.tgz Changelog version Dec 3, 2006, md5sum: bf1862632e261aff277451ac5abc07d8)
Extract this archive.
Edit putools\phpush.py adding the following two lines at the top (see screenshot 1):
import sys
sys.path.append('E:\\Python\libs')
Open the 'Bluetooth File Exchange' application. Press cancel to the file selection box.
Go to File->Browse Device.
Copy the modified putools\phpush.py to E:\Python.
Browse to E:\Python and create a 'libs' directory.
Copy putools\libs\*.py to E:\Python\libs\ on the phone (fnmatch.py, glob.py, phcomm.py, pushlib.py)
Edit putools\pcfiles\sync.config
Set COM_PORT = '/dev/tty.bt_console'
Or whatever the name of the serial port was that you created in Step 3 of the Prerequisite Instructables guide. You did follow that guide, right?
These assume you have a memory card in your phone which mounts at E:\. Adjust accordingly if you do not.
Extract this archive.
Edit putools\phpush.py adding the following two lines at the top (see screenshot 1):
import sys
sys.path.append('E:\\Python\libs')
Open the 'Bluetooth File Exchange' application. Press cancel to the file selection box.
Go to File->Browse Device.
Copy the modified putools\phpush.py to E:\Python.
Browse to E:\Python and create a 'libs' directory.
Copy putools\libs\*.py to E:\Python\libs\ on the phone (fnmatch.py, glob.py, phcomm.py, pushlib.py)
Edit putools\pcfiles\sync.config
Set COM_PORT = '/dev/tty.bt_console'
Or whatever the name of the serial port was that you created in Step 3 of the Prerequisite Instructables guide. You did follow that guide, right?
These assume you have a memory card in your phone which mounts at E:\. Adjust accordingly if you do not.
Connect PUTools!
On your mac, open a Terminal.
cd into putools/pcfiles/
chmod +x push
./push
Go to your phone and run the python shell.
Select Run Script and select e:phpush.py.
Select Other...
Select your Mac
Select 'bt_console' from the 'Choose port:' dialog.
Back on the mac,
kill push (CTRL-C)
wait a couple seconds and a 2nd time, run:
./push
Again, thats:
run push (OSX)
run phpush (phone)
CTRL-C push (OSX)
rerun push (OSX)
This should launch a wxpython window (seperate dock item) and give you a pretty nice shell. If not, move on to the next step for troubleshooting.
cd into putools/pcfiles/
chmod +x push
./push
Go to your phone and run the python shell.
Select Run Script and select e:phpush.py.
Select Other...
Select your Mac
Select 'bt_console' from the 'Choose port:' dialog.
Back on the mac,
kill push (CTRL-C)
wait a couple seconds and a 2nd time, run:
./push
Again, thats:
run push (OSX)
run phpush (phone)
CTRL-C push (OSX)
rerun push (OSX)
This should launch a wxpython window (seperate dock item) and give you a pretty nice shell. If not, move on to the next step for troubleshooting.
Troubleshooting
Here are some suggestions to try if you have issues:
From the bluetooth menu, disable and renable bluetooth.
Restart your phone.
Don't use the 'Default' when selecting the serial port to connect to.
If that doesn't work, try deleting the pairing from your phone and OSX, pair them again, restart and try again.
And remember, the order is:
push on OSX (from terminal)
phpush on the phone.
CTRL-C push on OSX
relaunch push on OSX.
More links that might help:
http://people.csail.mit.edu/kapu/symbian/python.html
http://rudolph.csail.mit.edu/~rudolph/mediawiki/index.php/Software,_tools,_and_support
From the bluetooth menu, disable and renable bluetooth.
Restart your phone.
Don't use the 'Default' when selecting the serial port to connect to.
If that doesn't work, try deleting the pairing from your phone and OSX, pair them again, restart and try again.
And remember, the order is:
push on OSX (from terminal)
phpush on the phone.
CTRL-C push on OSX
relaunch push on OSX.
More links that might help:
http://people.csail.mit.edu/kapu/symbian/python.html
http://rudolph.csail.mit.edu/~rudolph/mediawiki/index.php/Software,_tools,_and_support