Help - Search - Members - Calendar
Full Version: Python Support
OESF Portables Forum > Model Specific Forums > Sharp Zaurus > Zaurus - pdaXrom
First, a few notes:

1. i started this topic as a general place to discuss anything related to python on pdaXrom
2. i hope this topic will stay clear enough to serve as a knowledge-base
3. if you think this is a good idea, please:

a) use keywords in your posts, i recommend:

package <python_stdlib_package name> if it concernes some std lib package

error <short_description> if you encounter an error and you want to help solving it (think over if there is not a better place to ask (such as python mailing list)

error importing <package> if you encounter an error with package import thta should be working

i believe you can think up your own reasonable keywords

b) keep it simple and threaded -- problems with forums is, that it contains the info you need, but it is hard to find them (that's why the keywords :)

error importing pygtk

2006-04-22, 1.1.0beta3

this error shows up if you used to import the pygtk the way it is supposed for example in pyGtk tutorial:

import pygtk
import gtk

the solution i experienced is to import only the gtk module

#import pygtk
import gtk

in such a case all the gtk objects are still directly available and you can use them.
error importing threading

2006-04-22, 1.1.0beta3

i encountered an error importing threading module after succesfull installation

it complains about importing a non-existent 'collections' module in "/usr/lib/python2.4/" line 13

collections module is new in python 2.4 and is not available as an ipk package as of the date of this post (see above)

you can probably solve this by copying the module from your desktop distro to the zaurus, thouhg i didnt try (i use python 2.3 still)

so i ask the developers of the python pdaXrom packages to enable that module in ipk feed
tip: emacs & python-mode

2006-04-22, 1.1.0beta3

installing emacs with python support (ie. python-mode) on pdaXrom is easy and takes only these steps:

1. install emacs, best way is to use packages provided by pgas, see feed:

Pgas feed

(i have to download them by hand and install manually with ipkg command: ipkg -d /home/user install <ipg_package>)

2. download the python-mode distribution from surceforge

python-mode from download

(just grap the latest version)

3. unpack somewhere, i use ~/.emacs.d/site-lisp for packages i maintain locally

4. load the module in a standard way to your emacs (part of .emacs):

;; include the location of python-mode.el to your load path
(add-to-list 'load-path "~/.emacs.d/site-lisp")
;; load it
(load "python-mode")
;; associate the file extension with the desired mode
(setq auto-mode-alist (append '(("\\.py$" . python-mode)) auto-mode-alist))
(setq auto-mode-alist (append '(("\\.jy$" . python-mode)) auto-mode-alist))
(setq auto-mode-alist (append '(("\\.psp$" . python-mode)) auto-mode-alist))
tip: ipython and easy_install

ipython is an interactive python shell with autocomplete and more (

requirements are installed readline

1. install easy-install first from
2. install ipython: easy_install ipython
QUOTE(bubak @ Apr 22 2006, 11:13 AM)
error importing threading


this problem can be solved by unistalling the python-core ipkg and installing the python, which includes all the standard packages for python distribution

remember to always isntall at least one python interpreter (ie. python-core or python) with gtk support (pygtk ipkg) because several gui application are using it (, ...)

some notes:

1. python ipkg itself requires more than cca 16M of free space, the download size is cca 5M

2. there are problems when installing python and than pygtk -- the pygtk depends on python-core instead of python or python-core, so installing pygtk installs also python-core and dependencies, which results in ovewriting some of python files (well, the overwriting does not really matter -- the python is superset of python-core, but it leaves things in somewhat strange state)

3. my recommandation is just to install python and than by hand install pygtk -- pygtk actually installs only modules (files) under <root>/usr/lib/python2.4/site-packages; is is perfectly safe to extract the files there
QUOTE(fabianE @ Apr 23 2006, 12:18 AM)
tip: ipython and easy_install


easy-install requires full python installation, so replace python-core with full sized python, see my other post on "error importing threading" how to achieve this
easy-install requires full python installation, so replace python-core with full sized python, see my other post on "error importing threading" how to achieve this

That's interesting, I didn't notice that we have two version from python to choose from. What about python development headers, are there also available? Some python-eggs like RuleDispatch need them to compile...


I need know whats packages have this modules for python:

QUOTE(anunakin @ May 3 2006, 02:14 PM)

1. fnmatch, glob, pickle, pickletools => use python2.4 (you should remove the 'python-*' (even the python-core) and install just pure python 2.4.1) ... this is complete installation f python 2.44 indluding all the stdlib packages (codecs, dbus, xml, ...)

you should also install pygtk to enable some gui system tools. unfortunately enough pygtk depends on python-core (that should be removed by now) so do not install the dependencies for it (you aready have them)

2. Numeric => extension of python, usually called 'numeric python', not part of the stdlib (dont know where to get those, you should probably compile them, you may also try easy_install Numeric, if you use easy_install)
QUOTE(bubak @ May 13 2006, 03:12 PM)
2. Numeric => extension of python, usually called 'numeric python', not part of the stdlib (dont know where to get those, you should probably compile them, you may also try easy_install Numeric, if you use easy_install)

Anunakin has already compiled Numeric himself smile.gif

-- cheers
Installing any Python module on pdaXrom

A Python ignoramus wants to run a Python application (in my case DCD for telescope control) that requires some modules not found in the standard install. What is the way to go about finding and installing the required modules? Do you have to find an ipk that is specific to pdaXrom and the Python version? Can you use the .py-files in the cross compiler environment library and if so, how? I don't know what "installing a python module" actually means...
Actually, in most cases, you can just copy the python files into your Z from any machine (even Windows!) if they are just python files. On your Z look in /usr/lib/python2.* and you will see lots of directories and python files. Look on your machine where the app is working in python's lib directory. Find the one you think it needs and copy it over.

You won't break anything that way as long as you just add files (not overwrite them).

The "modules" are just python code, and that is the beauty of python, code that runs on ANY platform!
Thanks clofland, sounds good.

To spell out what to do (according to what I found on the web, correct me if wrong):
Find the .pyc files for the modules asked for (on your laptop or on the web, they're platform independent so can be used as is) and copy them to the /usr/lib/python2.* folder on your Zaurus. If you're finding .py files rather than .pyc files, you can generate the .pyc files by compiling the .py files with e.g. "python" from a shell prompt.

Well, I'm still stuck. I need the module which isn't in the python libraries on my laptop (but is!?! What is that about?). Found it online, but the very first line in it reads:
from java import util, lang
which generates the error "No module named java". Now the couple of files I have managed to find are different and have no "util" or "lang" in them, so I suspect there is no default module. What is the problem I need to fix here?
On my C3000 with 1.1.0beta1, I'm trying to run PySol which provides tons of Solitaire-like games. The Python interpreter claimed about a number of missing modules which I copied from my desktop Linux box and their error messages went away.

However, now it claims that "TKinter" is missing. I couldn't find any module with that name. As far as I figured out "TKinter" has something to do with Tcl/Tk and needs somewhat compiled directly into the Python interpreter.

Q: Has somebody tried to compile Python for pdaXrom with "TKinter" support included?
To natively compile Python programs on the Zaurus:

edit /usr/lib/python2.4/config/Makefile and change all instances of armv5etl-cacko-linux-gcc, g++, arm ranlib to just the toolname, i.e. gcc, g++ etc.

make a link to python include dir, as follows:
mkdir -p /usr/include
cd /usr/include
ln -s /opt/native/arm/3.4.4-xscale-softfvp/armv5tel-cacko-linux/include/python2.4 . (or wherever Python.h lives)

This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2018 Invision Power Services, Inc.