wasm-demo/demo/ermis-f/python_m/cur/0100

66 lines
2.3 KiB
Plaintext
Raw Permalink Normal View History

From: tim_one at email.msn.com (Tim Peters)
Date: Sat, 3 Apr 1999 07:54:54 GMT
Subject: W9x "import" case sensitivity
In-Reply-To: <37038658.FEAFF01F@palladion.com>
References: <37038658.FEAFF01F@palladion.com>
Message-ID: <000301be7da7$4277a3e0$879e2299@tim>
Content-Length: 1968
X-UID: 100
[Tim sez he's never had a problem with case-sensitive imports under Win95,
but that people at work do; speculates it may be due to non-Windows things,
like network servers and old source-control systems, that change filename
case seemingly at random
]
[Tres Seaver]
> On NT 4.0 SP3, with Python installed on NTFS E: drive:
>
> Python 1.5.2b1 (#0, Dec 10 1998, 11:29:56) [MSC 32 bit (Intel)] on win32
> Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
> >>> import SYS
> Traceback (innermost last):
> File "<pyshell#0>", line 1, in ?
> import SYS
> ImportError: No module named SYS
> >>> import sys
> >>> import HTMLLIB
> Traceback (innermost last):
> File "<pyshell#2>", line 1, in ?
> import HTMLLIB
> NameError: Case mismatch for module name HTMLLIB
> (filename E:\tools\Python\Lib\htmllib.py)
> >>> import htmllib
> >>>
>
> (Note the different error messages.)
This is not what I mean by having "a problem" -- this is working for you the
same way as it works under e.g. Unix, which is the way it's documented to
work.
"A problem" would be if Python griped on the
import htmllib
line too, where the import-name case *does* match the distributed filename
case. That's what I've seen happen at work, where the distributed filename
case somehow or other "gets changed" by "something", so that the *correct*
import statement doesn't work. That's never happened to me.
The different error msgs you're getting are due to sys being a builtin
module and not having a *file* named sys.py, Sys.py, SYs.py, sYs.py, sYS.py,
syS.py, or sYs.py on your PYTHONPATH. Create a file with one of those
names, and you'll get NameError instead of an ImportError when doing "import
SYS". Python doesn't check the builtin modules name for case mismatches,
and that's all that's going on here -- it may be seen as inconsistent, but
this too works the same way across all platforms.
caseclarifyingly y'rs - tim