[egenix-users] PROBLEM: mxCGIPython 0.5.0
M.-A. Lemburg
mal at lemburg.com
Thu Sep 19 14:11:56 CEST 2002
Yasushi Iwata wrote:
> On Thu, 19 Sep 2002 10:55:11 +0200 you wrote:
>
>
>>This could be caused by missing codecs. Please set the environment
>>variable PYTHONVERBOSE and rerun the script to see the traceback.
>
>
> The traceback is:
>
> $ export PYTHONVERBOSE=x
> $ ./cgipython hello
> import site # frozen
> import os # frozen
> import posix # builtin
> import posixpath # frozen
> import stat # frozen
> import UserDict # frozen
> import copy_reg # frozen
> import types # frozen
> import __future__ # frozen
> 'import site' failed; traceback:
> Traceback (most recent call last):
> File "/tmp/Python-2.2.1/Lib/site.py", line 95, in ?
> IndexError: list index out of range
Interesting. This is the line causing the problem:
# Append ./build/lib.<platform> in case we're running in the build dir
# (especially for Guido :-)
if os.name == "posix" and os.path.basename(sys.path[-1]) == "Modules":
...
Looks as if sys.path is empty at the time site.py is loaded.
I tried a similar setup (no PYTHONPATH set, no PYTHONHOME) on
Linux:
private/tmp> ./cgipython test
'import site' failed; use -v for traceback
Hello World!
['.']
with test:
import sys
print 'Hello World!'
print sys.path
The problem goes away if you define the environment variable
PYTHONPATH as empty.
I'd say this is a bug in site.py; I can't see how it can assume
that sys.path is always set. I've fixed this in Python CVS.
--
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
_______________________________________________________________________
eGenix.com -- Makers of the Python mx Extensions: mxDateTime,mxODBC,...
Python Consulting: http://www.egenix.com/
Python Software: http://www.egenix.com/files/python/
More information about the egenix-users
mailing list