[Tutor] import site failed (WinXP)

Alexei Vinidiktov alexei.vinidiktov at gmail.com
Tue Jan 27 06:34:35 CET 2009


Since yesterday I've been having problems running Python. I've been
getting the error "import site failed; use -v for traceback". IDLE
won't start either.

The traceback seems to sugget that Python "cannot import name aliases".

I've tried uninstalling and reinstalling Python and also installing a
newer version of Python, but the problem persists even if I try
installing Python 2.6 instead of Python 2.5.2 which I had installed
till yesterday.

I'm on Windows XP SP3.

Here's the traceback:

C:\Documents and Settings\Alexei>c:\python25\python.exe -v
# installing zipimport hook
import zipimport # builtin
# installed zipimport hook
# c:\python25\lib\site.pyc matches c:\python25\lib\site.py
import site # precompiled from c:\python25\lib\site.pyc
# c:\python25\lib\os.pyc matches c:\python25\lib\os.py
import os # precompiled from c:\python25\lib\os.pyc
import errno # builtin
import nt # builtin
# c:\python25\lib\ntpath.pyc matches c:\python25\lib\ntpath.py
import ntpath # precompiled from c:\python25\lib\ntpath.pyc
# c:\python25\lib\stat.pyc matches c:\python25\lib\stat.py
import stat # precompiled from c:\python25\lib\stat.pyc
# c:\python25\lib\UserDict.pyc matches c:\python25\lib\UserDict.py
import UserDict # precompiled from c:\python25\lib\UserDict.pyc
# c:\python25\lib\copy_reg.pyc matches c:\python25\lib\copy_reg.py
import copy_reg # precompiled from c:\python25\lib\copy_reg.pyc
# c:\python25\lib\types.pyc matches c:\python25\lib\types.py
import types # precompiled from c:\python25\lib\types.pyc
import _types # builtin
# c:\python25\lib\locale.pyc matches c:\python25\lib\locale.py
import locale # precompiled from c:\python25\lib\locale.pyc
import encodings # directory c:\python25\lib\encodings
# c:\python25\lib\encodings\__init__.pyc matches c:\python25\lib\encodings\__ini
import encodings # precompiled from c:\python25\lib\encodings\__init__.pyc
# c:\python25\lib\codecs.pyc matches c:\python25\lib\codecs.py
import codecs # precompiled from c:\python25\lib\codecs.pyc
import _codecs # builtin
'import site' failed; traceback:
Traceback (most recent call last):
  File "C:\Python25\lib\site.py", line 415, in <module>
  File "C:\Python25\lib\site.py", line 406, in main
  File "C:\Python25\lib\site.py", line 356, in aliasmbcs
    import locale, codecs
  File "C:\Python25\lib\locale.py", line 14, in <module>
    import sys, encodings, encodings.aliases
  File "C:\Python25\lib\encodings\__init__.py", line 32, in <module>
    from encodings import aliases
ImportError: cannot import name aliases
# c:\python25\lib\warnings.pyc matches c:\python25\lib\warnings.py
import warnings # precompiled from c:\python25\lib\warnings.pyc
# c:\python25\lib\linecache.pyc matches c:\python25\lib\linecache.py
import linecache # precompiled from c:\python25\lib\linecache.pyc
Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] on
Type "help", "copyright", "credits" or "license" for more information.

Alexei Vinidiktov

More information about the Tutor mailing list