|
While Java and Symbian C++ are powerful programming languages, their learning curves are too steep for most smart phone users. Most users do not need a full-blown programming platform to develop small hacks for their phone. A scripting language is the perfect tool to automate simple tasks and perform simple logical processing.
Python is a widely used scripting language in the computer world. It is easy to learn and supports object-oriented program construction. Nokia provides support for Python on most of its Series 60 devices.
Install the Python Environment
The current Nokia phones do not come with the Python runtime environment pre-installed. You have to download and install Python yourself.
You can download the Python for Series 60 package from the Forum Nokia web site under the Series 60 Platform ’ Tools and SDKs category. The download package is a zip file with the .sis installation files, documentation, and example code. Make sure you read the Getting Started document in the download bundle to choose the correct .sis file for your phone. Then, you need to install the extracted .sis file to the phone, following the instructions in "Run Symbian Applications" [Hack #17]. The .sis file installs the following components to the phone:
- A Python language interpreter
- The necessary libraries (DLL files) to run Python applications
- A plug-in for the phone to recognize Python scripts and Python libraries downloaded from the Internet or embedded in incoming messages
Once the Python runtime is successfully installed, a Python icon appears in the Main menu.
Run Python Scripts
Click the Python icon to open it and then select Options ’ Run script. You should see a list of installed Python scripts and applications (see Figure 3-10). If this is the first time you've run Python, the scripts that appear will be the demo scripts from Nokia. You can try any of them. The filebrowser.py script is a good start. It allows you to browse the filesystem on the Series 60 smart phone, similar to what FExplorer does [Hack #20]).
Install Python Scripts
Of course, ultimately you want to install and run your own Python scripts on the device. To do that, you can put the Python script (with the .py filename suffix) on a web page and download it using the Services browser, or you can simply send the script to the phone via Bluetooth. The phone recognizes the Python script and prompts you to install it. Once the script is installed, it becomes available under the Python script list and you can run it from there.
|