Author Topic: Python Support  (Read 6756 times)

bubak

  • Newbie
  • *
  • Posts: 13
    • View Profile
    • http://
Python Support
« on: April 22, 2006, 04:55:13 am »
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 :)

thanks.
SL-C3200
pdaXrom 1.1.0beta3
1G Kingston SD
WiFi Planex GW-CF11X
Bluetooth USB 3com dongle,
Sharp CE-RH2 remote

bubak

  • Newbie
  • *
  • Posts: 13
    • View Profile
    • http://
Python Support
« Reply #1 on: April 22, 2006, 05:05:52 am »
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:

Code: [Select]
import pygtk
pygtk.require("2.0")
import gtk

the solution i experienced is to import only the gtk module

Code: [Select]
#import pygtk
#pygtk.require("2.0")
import gtk

in such a case all the gtk objects are still directly available and you can use them.
SL-C3200
pdaXrom 1.1.0beta3
1G Kingston SD
WiFi Planex GW-CF11X
Bluetooth USB 3com dongle,
Sharp CE-RH2 remote

bubak

  • Newbie
  • *
  • Posts: 13
    • View Profile
    • http://
Python Support
« Reply #2 on: April 22, 2006, 05:13:46 am »
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/threading.py" 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
SL-C3200
pdaXrom 1.1.0beta3
1G Kingston SD
WiFi Planex GW-CF11X
Bluetooth USB 3com dongle,
Sharp CE-RH2 remote

bubak

  • Newbie
  • *
  • Posts: 13
    • View Profile
    • http://
Python Support
« Reply #3 on: April 22, 2006, 05:31:59 am »
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 sf.net 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):

Code: [Select]
;; 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))
« Last Edit: April 23, 2006, 04:23:25 am by bubak »
SL-C3200
pdaXrom 1.1.0beta3
1G Kingston SD
WiFi Planex GW-CF11X
Bluetooth USB 3com dongle,
Sharp CE-RH2 remote

fabianE

  • Jr. Member
  • **
  • Posts: 60
    • View Profile
Python Support
« Reply #4 on: April 22, 2006, 06:18:48 pm »
tip: ipython and easy_install

ipython is an interactive python shell with autocomplete and more (http://ipython.scipy.org/)

requirements are installed readline

1. install easy-install first from http://peak.telecommunity.com/DevCenter/EasyInstall
2. install ipython: easy_install ipython

bubak

  • Newbie
  • *
  • Posts: 13
    • View Profile
    • http://
Python Support
« Reply #5 on: April 30, 2006, 06:48:11 am »
Quote
error importing threading

2006-04-30

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 (cpuoverclock.py, ...)

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
SL-C3200
pdaXrom 1.1.0beta3
1G Kingston SD
WiFi Planex GW-CF11X
Bluetooth USB 3com dongle,
Sharp CE-RH2 remote

bubak

  • Newbie
  • *
  • Posts: 13
    • View Profile
    • http://
Python Support
« Reply #6 on: April 30, 2006, 06:52:24 am »
Quote
tip: ipython and easy_install

2006-04-30

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
SL-C3200
pdaXrom 1.1.0beta3
1G Kingston SD
WiFi Planex GW-CF11X
Bluetooth USB 3com dongle,
Sharp CE-RH2 remote

fabianE

  • Jr. Member
  • **
  • Posts: 60
    • View Profile
Python Support
« Reply #7 on: April 30, 2006, 07:20:36 am »
Quote
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
[div align=\"right\"][a href=\"index.php?act=findpost&pid=125179\"][{POST_SNAPBACK}][/a][/div]

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...

Regards,

Fabian

anunakin

  • Sr. Member
  • ****
  • Posts: 340
    • View Profile
    • http://vivaphp.net
Python Support
« Reply #8 on: May 03, 2006, 08:14:10 am »
I need know whats packages have this modules for python:
Code: [Select]
Numeric
fnmatch
glob  
pickle
pickletools
[img]http://www.vivaphp.net/imagens/rev2.jpg\" border=\"0\" class=\"linked-sig-image\" /]
Anunakin (Marcus Fazzi)

Nokia N900 32GB + microSD 2GB
Nokia N810 w/ microSD 8GB
Nokia 5310 XpressMusic w/ microSD 1GB
HP48GX->Psion Sienna->Palm m130->Tungsten T->Zaurus SL-5500->C3000->C3100 ALL SOLD

My FEED(On Line AGAIN!!!)

bubak

  • Newbie
  • *
  • Posts: 13
    • View Profile
    • http://
Python Support
« Reply #9 on: May 13, 2006, 11:12:38 am »
Quote
Code: [Select]
Numeric
fnmatch
glob  
pickle
pickletools

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)
« Last Edit: May 13, 2006, 11:15:50 am by bubak »
SL-C3200
pdaXrom 1.1.0beta3
1G Kingston SD
WiFi Planex GW-CF11X
Bluetooth USB 3com dongle,
Sharp CE-RH2 remote

desertrat

  • Hero Member
  • *****
  • Posts: 743
    • View Profile
    • http://
Python Support
« Reply #10 on: May 13, 2006, 03:30:06 pm »
Quote
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

http://mail.pdaxrom.org/contrib/anunakin/

-- cheers
SL-C3100 / Ambicon WL1100C-CF / pdaXrom 1.1.0beta3 / IceWM

flyvholm

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • http://
Python Support
« Reply #11 on: June 16, 2006, 01:29:29 am »
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...
SL-C1000, pdaXrom 1.1.0beta1
Ubuntu 6.06 (Dapper) on Compaq R3000Z

clofland

  • Full Member
  • ***
  • Posts: 247
    • View Profile
    • http://www.lofland.net/
Python Support
« Reply #12 on: June 16, 2006, 09:28:37 am »
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!
C-760 Last Running pdaXrom 1.1.0beta3
- Sandisk UltraII 1GB SD card - Socket LP CF LAN card - Socket LP CF WLAN card - Socket CF Bluetooth Card Rev H -

flyvholm

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • http://
Python Support
« Reply #13 on: June 17, 2006, 05:29:29 am »
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 compileall.py" from a shell prompt.

Well, I'm still stuck. I need the module zlib.py which isn't in the python libraries on my laptop (but test_zlib.py 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 java.py files I have managed to find are different and have no "util" or "lang" in them, so I suspect there is no default java.py module. What is the problem I need to fix here?
« Last Edit: June 17, 2006, 05:30:46 am by flyvholm »
SL-C1000, pdaXrom 1.1.0beta1
Ubuntu 6.06 (Dapper) on Compaq R3000Z

maystorm

  • Newbie
  • *
  • Posts: 48
    • View Profile
    • http://
Python Support
« Reply #14 on: July 31, 2006, 03:38:03 pm »
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?
Owner of a very happy Zaurus SL-C3000 since the day he was fed with pdaXrom 1.1.0beta1! Just made him even more happy by feeding him with pdaXii13 build 5.4.7.