NameError: Case mismatch for module name sys

Tim Roberts timr at probo.com
Sun May 12 01:01:41 EDT 2002


Peter Hansen <peter at engcorp.com> wrote:

>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('')

I only see one little problem with your suggested fix: the basic problem is
that he cannot "import sys" in the first place.  If your fix actually
worked, he wouldn't need it.

I don't see any way around his issue without renaming his Sys.py.  If Sys
is already imported, then the Python "import sys" is always going to find
the already loaded one, and won't ever try to find another.  Right?
--
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.



More information about the Python-list mailing list