[Tutor] Fwd: import site failed (WinXP)

Kent Johnson kent37 at tds.net
Tue Jan 27 17:38:23 CET 2009


Forwarding to the list


---------- Forwarded message ----------
From: Alexei Vinidiktov <alexei.vinidiktov at gmail.com>
Date: Tue, Jan 27, 2009 at 11:24 AM
Subject: Re: [Tutor] import site failed (WinXP)
To: Kent Johnson <kent37 at tds.net>


2009/1/27 Kent Johnson <kent37 at tds.net>:
> 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 ?

When I try C:\Python26\python.exe -v, it does show that.

>
> My best guess is that somehow Python is finding the wrong
> encodings\aliases.py.

I can't find an aliases.py file within the encodings folder. Should it be there?

Do you have a folder called encodings or a file
> called aliases.py anywhere on your PYTHONPATH?

I don't have a PYTHONPATH environment variable defined.

Does Python work if you
> start it from a different working directory?

No, it doesn't seem to work properly no matter what directory I run it from.


--
Alexei Vinidiktov


More information about the Tutor mailing list