Case mismatch on NT

Guido van Rossum guido at cnri.reston.va.us
Thu Jul 15 18:52:01 EDT 1999


Hoon Yoon <hyoon at bigfoot.com> writes:

>  I realize that this has been discussed before. And you might think the
> solution is  os.environ["PYTHONCASEOK"] = "hotdog" but try this one.
>  There is dialog.py sitting in pythonwin/.../mfc directory and Dialog.py
> in lib-tk directory. If I have both directory in my Pythonpath, I cannot
> call the one sitting at the second directory with out encountering the
> dreaded "Case Mismatch" error.
>  I feel that "Case Mismatch" should only occur after all directories has
> been searched to find the 'right' case import. Not after finding the
> first non-matching one. Is there a way to set environ to do what I want?
>  If not, can anyone tell me how to get around this prob or tell me if
> what I am proposing makes sense or not?

This is intentional -- it prevents people from *relying* on the case
matching to make their program work.  (The case sensitivity is there
to make your program fail if you typed "import String" when you meant
"import string".)

Two workarounds: (1) make a copy of the second one with a different
name, and use that; (2) rearrange your sys.path so that the one you
want to use comes first.  Neither might work if you have some library
module that uses one and some other library module that uses the other...

--Guido van Rossum (home page: http://www.python.org/~guido/)




More information about the Python-list mailing list