NameError: Case mismatch for module name sys

Peter Hansen peter at engcorp.com
Fri May 10 23:18:51 EDT 2002


Peter Hansen wrote:
> 
> You could do this, though it's pretty ugly:
> 
> import sys
> if sys.path[0] == '':
>     sys.path.remove('')
>     sys.path.append('')
> 
> which will strip the current directory from the list of directories
> in the python search path and add it again at the end.  I doubt this
> is recommended and I can think of a few ways this could spell trouble.
> But it might work.

Could also just remove the "if" from the above.  And hope you don't
have '' in there more than once.  This is a hack.

> A better approach is just to rename some files.  Is there really any
> reason you can just 'ren Sys.py sys2.py' for example?
             ^^^
D'oh!  I meant "can't", of course.



More information about the Python-list mailing list