[Tutor] import site failed (WinXP)

Kent Johnson kent37 at tds.net
Tue Jan 27 13:04:50 CET 2009


On Tue, Jan 27, 2009 at 12:34 AM, Alexei Vinidiktov
<alexei.vinidiktov at gmail.com> wrote:
> Hello,
>
> 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:
>

> 'import site' failed; traceback:
> Traceback (most recent call last):
>  File "C:\Python25\lib\site.py", line 415, in <module>
>    main()
>  File "C:\Python25\lib\site.py", line 406, in main
>    aliasmbcs()
>  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

That's a puzzle. When you installed Python 2.6, does it show
C:\Python26 in the paths when you try python2.6 -v ?

My best guess is that somehow Python is finding the wrong
encodings\aliases.py. Do you have a folder called encodings or a file
called aliases.py anywhere on your PYTHONPATH? Does Python work if you
start it from a different working directory?

puzzled...
Kent


More information about the Tutor mailing list