You are not logged in.
Pages: 1
This has been a problem for me for some time now, and I have yet to find a solution. It seems that when I try to run any python program that loads modules I get an ImportError: No module name xyz . If I set PYTHONPATH to the exact directory for module xyz it seems to solve the problem, however it seems to require the exact directory and I can't just use /usr/lib/python2.4. It any one has a solution for me I would appreciate it.
--
Alex
Offline
it works for me without problems,
I know that there was a problem when python was upgraded to 2.4 but all the packages were rebuilt and that fixed it,
arch + gentoo + initng + python = enlisy
Offline
hmmm, that's an odd one... can you check the following:
$ pacman -Qi python <-- what version?
$ python
>>> import os
>>> dir(os) <----- do base library modules work?
>>> import <seperate module>
>>> dir(<seperate module>)
Offline
[alex@espc3 ~]$ pacman -Qi python
Name : python
Version : 2.4-3
Groups : None
Packager : dorphell <dorphell@archlinux.org>
URL : http://www.python.org
License :
Architecture : i686
Size : 32971815
Build Date : Tue Feb 22 21:29:03 2005 UTC
Install Date : Wed Mar 23 07:43:19 2005 UTC
Install Script : No
Reason: : explicitly installed
Provides : None
Depends On : bzip2 db gdbm openssl
Required By : amarok-devel apsw freevo gmpy kdeaddons kdesdk mmpython pil
pycrypto pylirc pyopenssl pyserial pyshadow python-numeric
python-pygame pyxml superkaramba twisted wxpython
Conflicts With : None
Description : A high-level scripting language
[alex@espc3 ~]$ python
'import site' failed; use -v for traceback
Python 2.4 (#1, Feb 22 2005, 16:26:12)
[GCC 3.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
Traceback (most recent call last):
File "<stdin>", line 1, in ?
ImportError: No module named os
>>> dir(os)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
NameError: name 'os' is not defined
>>>
Here is the output from your suggestions. It suggests doing python -v so I did and the following is the response I got.
[alex@espc3 ~]$ python -v
# installing zipimport hook
import zipimport # builtin
# installed zipimport hook
'import site' failed; traceback:
ImportError: No module named site
Python 2.4 (#1, Feb 22 2005, 16:26:12)
[GCC 3.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
I hope this helps in the diagnoses. I pacman -Syu atleast every other day, and tried to reinstall python just the other day but that did not help. I bielve that this problem began after I originally upgraded from 2.3 to 2.4
--
Alex
Offline
hrrrmmm:
first do:
# find /usr/lib -name site.py
to make sure you even have the site module...
then check the permissions on the file...
after that, check that "/usr/lib/python2.4" is in your PATH var... also check the PYTHONHOME env var
Offline
[alex@espc3 ~]$ find /usr/lib -name site.py
/usr/lib/python2.4/site.py
[alex@espc3 ~]$ ls -l /usr/lib/python2.4/site.py
-rw-r--r-- 1 root root 13833 2005-02-22 13:28 /usr/lib/python2.4/site.py
[alex@espc3 ~]$ echo $PATH
/bin:/usr/bin:/sbin:/usr/sbin:/usr/X11R6/bin:/opt/bin:/home/alex/bin:/usr/lib/python2.4:/opt/java/jre/bin:/opt/kde/bin:/opt/mozilla/bin:/opt/qt/bin
[alex@espc3 ~]$ echo $PYTHONHOME
/usr/lib/python2.4
It appears that I do have site.py installed and that /usr/lib/python2.4 is in both PATH and PYTHONHOME. I am not sure what the exact permissions should be. I appreciate you taking the time to help me out with this.
--
Alex
Offline
phrakture, I would like to thank you for your time...
I think I have solved my problem by using strace on python. It turns out that PYTHONHOME should be /usr and not /usr/lib/pthon2.4 as it then tries to access the libraries from /usr/lib/python2.4/lib/python2.4.
After changing this everything appears to work correctly, hopefully for good.
Thanks again.
--
Alex
Offline
Offline
Hmm, weird. I still have the problem with importing basic modules like 'os' in python. I've made sure that my PATH and PYTHONHOME are Ok but it changes nothing.
?What's wrong with this python package?!
EDIT: It appears that the superkaramba package in testing needs to be rebuilt against python2.4 because it can't find python modules. When I import modules in CLI python it works just fine.
Offline
EDIT: It appears that the superkaramba package in testing needs to be rebuilt against python2.4 because it can't find python modules. When I import modules in CLI python it works just fine.
mark it out of date
Offline
It looks like it's been removed already. That's good.
I've built a package of superkaramba compliant with python2.4, unfortunately I realise that the PKGBUILD I used is not perfect At least, it works perfectly for me I'll post it here so you can adjust it to your taste ;-)
pkgname=superkaramba
pkgver=0.35
pkgrel=1
pkgdesc="SuperKaramba is, in simple terms, a tool that allows you to easily create interactive eye-candy on your KDE desktop. Currently, only linux is officially supported. "
license="GPL"
depends=('kdebase' 'kdelibs' 'python')
makedepends=()
conflicts=()
replaces=()
backup=()
install=
source=(http://www.angelfire.com/geek/p0z3r/superkaramba-0.35-Python2.4.tar.gz)
build() {
cd $startdir/src/superkaramba-0.35-Python2.4
./configure --prefix=/opt/kde
make || return 1
make DESTDIR=$startdir/pkg install
}
Offline
Pages: 1