Skip to content


Create installable applications (.sis files) from your Python scripts for Symbian

Python is great. It makes everything simple. Also, it can be run almost anywhere, even on your Nokia smartphones. In this post I will show you how to create an installable application (.sis file) from your Python scripts.

The first step is to install Python 2.5 on your computer. It has to be 2.5. If you have a newer version of Python installed, either downgrade to 2.5 or create a local folder with Python 2.5 executable on it and make sure you use that version. You can install Python 2.5 from here.

If you are on Ubuntu, probably you have a newer version of Python. Just get the source and compile it locally:

cd ~
mkdir py2sis
cd py2sis
wget http://www.python.org/ftp/python/2.5.4/Python-2.5.4.tgz
tar -xvzf Python-2.5.4.tgz
rm Python-2.5.4.tgz
cd Python-2.5.4
./configure
make

OK, so now we should have a local copy of Python 2.5.4. To test that everything is fine, run the following command:

~/py2sis/Python-2.5.4/python --version

It should report Python 2.5.4. Windows or Linux users that installed Python 2.5.4 on their entire system can always substitute ~/py2sis/Python-2.5.4/python by just python. For them, the following command should report the same result:

python --version
 

Now, we need to get the utilities that will allow us to create the sis files. That software is called ensymble. We need exactly this file: ensymble_python2.5-0.27.py

 cd ~/py2sis
wget http://ensymble.googlecode.com/files/ensymble_python2.5-0.27.py
~/py2sis/Python-2.5.4/python ~/py2sis/ensymble_python2.5-0.27.py version
 

You should get this result: Ensymble v0.27 2008-06-30.

Now let’s get PythonForS60 sis file that will be installed alongside your script. We need the file PythonForS60_1_4_5_3rdEd.sis.

cd ~/py2sis
wget http://sourceforge.net/projects/pys60/files/pys60/1.4.5/PythonForS60_1_4_5_3rdEd.sis/download
mv download PythonForS60_1_4_5_3rdEd.sis

All done configuring the tools. Now we are going to create a Python script.

cd ~
mkdir myFirstScript
cd myFirstScript
gedit default.py &

Here you can put any Python code for Symbian S60. Let’s start with something simple. Write this and save the file:

import appuifw
appuifw.note(u"Hello Symbian/Python World", "info")

Time to create your first Python SIS file. Execute the following:

cd ~
~/py2sis/Python-2.5.4/python ~/py2sis/ensymble_python2.5-0.27.py py2sis myFirstScript

It should generate a file called myFirstScript_v1_0_0.sis. This is the sis file for your script. If you already have PythonForS60 sis installed in your phone, it should work. Most of the time though, users will not have it, so let’s merge the two into just one sis:

cd ~
~/py2sis/Python-2.5.4/python ~/py2sis/ensymble_python2.5-0.27.py mergesis myFirstScript_v1_0_0.sis ~/py2sis/PythonForS60_1_4_5_3rdEd.sis myFirstScript_v1_0_0_with_Python.sis

Now, you can just install myFirstScript_v1_0_0_with_Python.sis in your Nokia Symbian S60 3rd edition phone (like the E71 for example) and when you open it, you should see something like this:

Great, so now let’s automate this using a script:

sudo touch /usr/local/bin/py2sis.sh
sudo chmod +x /usr/local/bin/py2sis.sh
sudo gedit /usr/local/bin/py2sis.sh &

Write these commands on the file:

#!/bin/bash
echo "Creating script sis file..."
~/py2sis/Python-2.5.4/python ~/py2sis/ensymble_python2.5-0.27.py py2sis myFirstScript
echo "Merging script sis file with Python for S60 sis file..."
~/py2sis/Python-2.5.4/python ~/py2sis/ensymble_python2.5-0.27.py mergesis myFirstScript_v1_0_0.sis ~/py2sis/PythonForS60_1_4_5_3rdEd.sis myFirstScript_v1_0_0_with_Python.sis
echo "Done."

Now let’s test it erasing the files we just created and then generating them with the script:

cd ~
rm myFirstScript_v1_0_0*
py2sis.sh

It should create the same 2 sis files we just created before manually. Now, let’s edit the script so that we can tell it where is our source code and set other options:

sudo gedit /usr/local/bin/py2sis.sh &

Replace the existing code with this:

#!/bin/bash

#Check that only 1 parameter is passed (the directory of your script)
EXPECTED_ARGS=1
if [ $# -ne $EXPECTED_ARGS ]
then
echo "Usage: `basename $0` [ScriptDirectory]"
exit -1
fi

#This is the directory where your Python for S60 Script is
PYTHON_SCRIPT_DIR=$1

#Application parameters
APP_SCRIPT_SIS_NAME="myApp.sis"
APP_SCRIPT_WITH_PYTHON_SIS_NAME="myApp_with_python.sis"
APP_NAME="My App"
APP_VERSION="1.0.0"
APP_SHORT_CAPTION="Short description."
APP_CAPTION="Here you can describe your application in more detail."
#Icon path. It should be a Tiny SVG compatible icon.
#To add an app icon, just uncomment the following line and edit the path to point to your icon
#APP_ICON=--icon="/path/to/your/icon.svg"

#Environment variables
PYTHON_PATH=~/py2sis/Python-2.5.4/python
ENSYMBLE_PATH=~/py2sis/ensymble_python2.5-0.27.py
PYTHON_FOR_S60_PATH=~/py2sis/PythonForS60_1_4_5_3rdEd.sis

echo "Creating script sis file..."
"${PYTHON_PATH}" "${ENSYMBLE_PATH}" py2sis --appname="${APP_NAME}" --version="${APP_VERSION}" --shortcaption="${APP_SHORT_CAPTION}" --caption="${APP_CAPTION}" ${APP_ICON} "${PYTHON_SCRIPT_DIR}" "${APP_SCRIPT_SIS_NAME}"
echo "Merging script sis file with Python for S60 sis file..."
${PYTHON_PATH} ${ENSYMBLE_PATH} mergesis ${APP_SIS_NAME} ${PYTHON_FOR_S60_PATH} ${APP_SCRIPT_WITH_PYTHON_SIS_NAME}
echo "Done."

There you can set many parameters for your app, like the name, icon, description, and more. Now you should be able to convert your Python scripts to a sis file by just doing this:

py2sis.sh ScriptDirectory

Remember to name the main script default.py since that is the file that ensymble is looking for inside the script folder.

Let’s test this new script, erasing the sis files and then executing this script to generate new sis files:

cd ~
rm myFirstScript_v1_0_0*
py2sis.sh myFirstScript

You should see now a myApp.sis and a myApp_with_python.sis files. Note that those were the properties set in the script. Anytime you want to change these settings, just run this and edit them directly:

sudo gedit /usr/local/bin/py2sis.sh &

OK, now go and create some cool Python apps in no time for your Nokia phone. Check out this excellent Symbian for S60 tutorial made by a fellow Nokia Forum Champion, Jurgen Scheible.

Posted in Programming.


18 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. deepak says

    thanks.its cool….
    but i am unable to make sis file for my nokia 5230..
    any help plzzzz…????????

  2. samontab says

    If you provide more details, maybe I or somebody else could help…

    Did you follow the instructions carefully?
    Try repeating everything from scratch, following instructions exactly. Where do you have a problem?, what does the error message say?, etc…

    Without that information, nobody will be able to help you.

  3. pkr says

    I just tried it for nokia 5230 and it works..

  4. Wojtas says

    You’re great! I didn’t know it’s even possible to create standalone sis files with programs on top of Python.
    The problem is when I run ensemble with python provided ,it requires zlib, which is not provided with this python file. Any hints?

  5. samontab says

    Just follow the instructions carefully and you should be able to compile it without a problem. Just copy and paste the code…

  6. Wojtas says

    I have another problem now – after compiling own python2.5 and running ensemble, I got:

    (…)
    File “/home/wojtas/projects/pysymbian/Python-2.5.4/Lib/hashlib.py”, line 133, in
    md5 = __get_builtin_constructor(‘md5’)
    File “/home/wojtas/projects/pysymbian/Python-2.5.4/Lib/hashlib.py”, line 60, in __get_builtin_constructor
    import _md5
    File “/home/wojtas/projects/pysymbian/Python-2.5.4/Lib/ihooks.py”, line 404, in import_module
    q, tail = self.find_head_package(parent, str(name))
    File “/home/wojtas/projects/pysymbian/Python-2.5.4/Lib/ihooks.py”, line 447, in find_head_package
    raise ImportError, “No module named ” + qname
    ImportError: No module named _md5
    wojtas@basement:~/projects/pysymbian$ python25 –version
    Python 2.5.4

  7. Raysel says

    Anybady can send me the program to my e-mail:rayselss@gmail.com

  8. samontab says

    Hello Raysel,

    Everything that you need is explained in the post.

  9. vigneshkumar says

    hi i’m vignesh can you tell what software want to use .sis file to create pls,i’m a student

  10. samontab says

    Hi vigneshkumar,

    You can use Qt SDK for general sis files, or follow this tutorial for using Python code.

  11. michaelxxx says

    Hi, i wanted to know if this .sis file could be installed in nokia 225 ?
    I’ve downloaded a file of Symbian OS, its an app for blocking unnecessary calls in nokia 225, since 225 doesn’t provide blacklist option. But as I put the file in my nokia 225, it just says ‘Can’t open this file’. Is this because we just can’t install a .sis file in nokia 225 or any other reason ?
    Reply ASAP

    Thank You.

  12. samontab says

    Hi Michaelxxx,

    I don’t know.

  13. pankaj says

    sir i am using nokia 5320 xpressmusic. and i have installed python and a program Aio torch.py for using camera flash as torch, but in the script it says camera size not supported. what to do? my mobile doesnt enable led flash while video recording. pls do something.

  14. jesbin mathew says

    how to create a wifi hacker using this for nokia e5(sis)

  15. Anand says

    I have no any symbian phone . Is there any working symbian emulator where i can install my sis app.?

Continuing the Discussion



Some HTML is OK

or, reply to this post via trackback.