Python for iPod
and other tools

Some pictures of the python interactive interpreter on iPod mini:

sash Entering the Matrix ;) python Exiting python

download Python for iPod


Info about iPod mini 1st gen. when wasn't supported by ipodlinux project: here.

Python for iPod

First of all, What is Python?
It's a programming language very easy to learn and very powerful to use. More info:

Python for iPod allows you run Python programs and the interactive python interpreter in the iPod.
That means, if you know about python programming language you can use only your iPod to write and execute programs (without a computer). This is useful because Python for iPod is the only computer language compiler/interpreter ported for iPod,i.e: if you want to execute a C program in your iPod you must write it in your computer, (cross-)compile it and transfer it to the iPod, if something in the program is wrong you must do the same process again... with Python not :)

IMPORTANT: You have to install ipodlinux before run python.

The author of this webpage (Jacobo Avariento) ported python 2.4.1 into iPod (ARM processor, FLT executable binary format) on May 2005.
Due to iPodRead.c file, developed by Jeffrey Nelson, Bernard Leach and others, I/O modifications to can type into python interactive interpreter, use raw_input() function, etc, were minimal.
iPodRead.c allows you to type into iPod scrolling left or right on the wheel.


Version: Python 4 ipod release candidate 3 (uploaded June 28, 2005)
* For python users: python2.4 [ 6.2 MB ]
howto install it

This file includes python, tcl and ncurses iPod ports.
You need /etc/python.conf, too.
* For python/ipod developers: Python 2.4.1 full sources for iPod [ 13 MB ]
diffs between standard distribution and python4ipod
How to cross-compile the Python interpreter

Modules supported: os, sys, math, md5, sha, ... even curses.

Changing the file browser.c in podzilla sources are required to can exec python programs in the File Browser of podzilla: (This podzilla has all the modifications done). (See the modifications in the table below).

If you want to execute a python script in a shell, just type 'python', or type 'python' to enter into python interactive interpreter.

NOTE: To exit of the python interactive interpreter press 'menu' and 'play' or type:
import sys
IMPORTANT: Python files must have extension .py, start with '#!/bin/python' and have exec permissions (chmod +x

browser.c (modifications)

static int is_script_type(char *extension) {
 return strcmp(extension, ".sh") == 0 || strcmp(extension, ".py") == 0;


static int is_binary_type(char *filename) {

 fread(header, sizeof(char), 12, fp);
 if (!strncmp(header, "bFLT", 4)  || \
     !strncmp(header, "#!/bin/sh", 9) || \
     !strncmp(header, "#!/bin/python", 13))
        return 1;
 else return 0;



Python-iPod benchmarking

Python-ipod benchmarking (done with the lastest kernel on April 1st 2006)
Pystone(1.1) time for 50000 passes = 171.36
This machine benchmarks at 291.783 pystones/second

Curses for iPod

Recently, I ported ncurses (well, rather than a port was a cross-compilation) for iPod: download.
ncurses interface can be used from this python port, too. (import curses)

WARNING: To use ncurses you have to create an environment variable called TERM, in a shell type: TERM=linux or TERM=vt100, can be possible that ncurses needs another two enviroment variables called LINES and COLUMNS.

NOTE: To avoid the staircase efect due to a misconfiguration of the terminal properties type: stty onlcr

ipodgetty (getty for iPod)

(It isn't finished yet, but usable version is available for download)

I programmed a reduced version of getty (based on rungetty) that set up the ipod terminal after the booting process, and put the enviromnent variables to can use ncurses and other programs like python or shell.
You can download an alfa version: binary and its source file.

To use ipodgetty, download the binary and edit the file /etc/inittab in your iPod and write:
foo:bar:ipodgetty /bin/Sash
Reboot your iPod and after boot, a shell starts, now you can run any app, to use podzilla type: podzilla.

For any questions/suggestions/feedback contact me: jack at gulcas dot org

Valid HTML 4.01