[Python-Dev] Embedded python on Win2K, import failures
Mark Hammond
mhammond@skippinet.com.au
Sat, 12 Apr 2003 11:41:14 +1000
[Harri]
> Hello,
>
> In a few hours old CVS checkout, I'm having problems getting the
> embedded python to work.
This is true even in non-embedded Python. Move away "_sre.pyd", and the
interactive session shows:
'import site' failed; use -v for traceback
>>> import re
>>> dir(re)
['__builtins__', '__doc__', '__file__', '__name__', 'engine']
Running with "-v" shows:
'import site' failed; traceback:
Traceback (most recent call last):
File "E:\src\python-cvs\lib\site.py", line 298, in ?
encodings._cache[enc] = encodings._unknown
AttributeError: 'module' object has no attribute '_unknown'
So, my speculation at this point is that for some reason, site.py now
depends on re, which depends on _sre - but somehow a "stale" import is left
hanging around.
Another strange point - executing "python", then typing "import re" is
completely silent, as we have noted. However, executing "python -c "import
re" dumps an exception:
python -c "import re"
'import site' failed; use -v for traceback
Traceback (most recent call last):
File "E:\src\python-cvs\lib\warnings.py", line 270, in ?
filterwarnings("ignore", category=OverflowWarning, append=1)
File "E:\src\python-cvs\lib\warnings.py", line 140, in filterwarnings
item = (action, re.compile(message, re.I), category,
AttributeError: 'module' object has no attribute 'compile'
I'm really not sure what is going on here. I'd suggest creating a bug at
sf.
Mark.