NameError: Case mismatch for module name sys

Peter Hansen peter at engcorp.com
Fri May 10 22:57:17 EDT 2002


Martin Erren wrote:
> 
> > > import traceback, sys
> > >
> > > "NameError: Case mismatch for module name sys"
> > > (filename lib\Sys\Sys.py)
> > >
> > > I don't need "Sys" in the package,
> > > but "sys" in the python-standard lib.
> 
> I'm not, too. In fact, this is written for Windows. I want to say:
> Don't take Sys.py in package Sys, but "sys" in Standard-Lib.
> Or say: "Always look in python-standard lib first"
> 
> When this is not possible, I try to write a wrapper in another package.

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.

A better approach is just to rename some files.  Is there really any 
reason you can just 'ren Sys.py sys2.py' for example? 

-Peter



More information about the Python-list mailing list