Import error !!

Gerhard Häring gh at ghaering.de
Wed Aug 20 03:27:25 EDT 2003


satish k.chimakurthi wrote:
> Hello all,
> 
> I am trying to import a module which was generated by a PYTHON-C++ interface 
> generator tool, which failed, and generated the following error : [...]
> # /usr/lib/python1.5/exceptions.pyc matches /usr/lib/python1.5/exceptions.py
> import exceptions # precompiled from /usr/lib/python1.5/exceptions.pyc
> # /usr/lib/python2.2/site.pyc has bad magic
> 'import site' failed; traceback:
>   File "/usr/lib/python2.2/site.py", line 64
>     dir = os.path.abspath(os.path.join(*paths))
>                                        ^
> SyntaxError: invalid syntax
> Python 1.5.2 (#1, Apr  3 2002, 18:16:26)  [GCC 2.96 20000731 (Red Hat Linux 
> 7.2 2 on linux-i386
> Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
> import readline # dynamically loaded from 
> /usr/lib/python1.5/lib-dynload/readline.so
> 
> I don't understand much from the above. Can someone suggest what this means ??

For some reason, your Pythons get mixed up (1.5.2 and 2.2). 1.5.2 
doesn't understand the argument expansion operator * yet.

The first thing I'd check is the Python module search path (sys.path). 
Maybe you're doing somethnig fancy like setting PYTHONPATH that causes 
this problem? Also, on your old Redhat system, you'll have to run Python 
2.2 with 'python2' instead of 'python'.

-- Gerhard





More information about the Python-list mailing list