Enumerating drives in Python or wxPython (different behavior in PythonWin and python.exe)
Alan Miller
ajm at enteract.com
Tue Jul 18 23:27:03 EDT 2000
David Bolen (db3l at fitlinxx.com) wrote:
[os.path.isdir() to identify drives, and what happens for removables]
>Alan Miller <ajm at enteract.com> writes:
>> Interesting, I tried it out before I posted and didn't have any problems.
>
>Strange - it did for me for A: (I did it just before posting as well).
>Perhaps it's a Windowism that depends on platform or some strange
>registry setting or something. I was on NT 4, SP4. In any event, I
>guess at the very least it means that it's behavior isn't guaranteed
>to be consistent.
Interesting, I'm on NT4WS, SP6a. It also works on a Win95 laptop with
the floppy drive missing, though it (Win95, really) goes out to lunch for
a few seconds waiting for a response from the drive.
>The problem was that isdir() didn't return an error - it returned 1
>(which I guess is ok, given that A:\ is technically valid even without
>a diskette), but the NT error while performing isdir() put up a
>message box that the user would have to answer before isdir() returned
>in the Python script.
I'm running Python 1.5.2 and PythonWin build 132, and I was running the
test from the PythonWin interactive window.
I just tried it from a command line Python and got the message you were
probably seeing - "There is no disk in the drive. Please insert a disk
into drive A:.\n[Abort][Retry][Ignore]"
I'm not sure what to do about that - obviously PythonWin is doing
something differently, but I'm not sure what - it should be using the
same modules, but I don't know if it has the builtin modules compiled
into it or if it calls python.exe. I suspect the entire interpreter and
the builtins are compiled in, possibly Visual C/Visual C++ does something
unusual in terms of optimization?
Hopefully the change in the subject will catch Mark's attention....
Mark, any thoughts on this?
ajm
More information about the Python-list
mailing list