[Tutor] mysterious Python error

Kent Johnson kent37 at tds.net
Sun Jul 31 16:28:45 CEST 2005


Tom Cloyd wrote:
> I'm working on a WinXP SP-2 OS.
> 
> I'm too ill-informed to figure this out: When I execute
> 
> C:\Python24\python.exe
> 
> I get
> 
> 'import site' failed.; use -v for traceback
> ActivePython 2.4.1 Build 247 ...
> 
> 
> I then ran this from a DOS window, and tried to redirect the -v output to  
> a text file, so I could include it, but nothing I did was successful. I  
> can't imagine why the output wouldn't redirect, but it would not. the file  
> remained empty.
> 
> The output from the python.exe -v command was verbose. The import that  
> failed was "import sitecustomize", which is in  
> ..\lib\sitepackages\sitecustomize.py

This is a strange error; usually a module doesn't import itself. It sounds like your sitecustomize.py may be corrupt. What happens if you remove it (this file is optional)? Can you post the contents of the file here?

Kent

> 
> There was also protest about another line in that file: sys  
> setdefaultencoding('utf-8') --
> "NameError: name 'sys' is not defined."
> 
> The interpreter DID become active, after all this.
> 
> I attempted to fix this by removing and reinstalling the ActivePython  
> 2.4.1 Windows package. It didn't change anything at all.
> 
> Can anyone suggest what I might do with this?
> 
> Thanks for your help.
> 
> -- Tom
> 
> ======================================================
> Tom Cloyd, MS MA, LMHC
> Private practice Psychotherapist
> Bellingham, Washington, U.S.A: (360) 920-1226
> << BestMindHealth.com / tc at bestmindhealth.com >>
> ======================================================
> 
> Using Opera's revolutionary e-mail client (program):  
> http://www.opera.com/mail/
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
> 



More information about the Tutor mailing list