Win32 Drive List Redux
Tim Daneliuk
tundra at tundraware.com
Thu Jan 2 12:50:06 EST 2003
Some time ago, there was a brief thread on how to get a list of
available drives on Win32. Peter Hansen suggested the use of:
win32api.GetLogicalDriveStrings()
And Ken Seehof suggested:
def drives():
d = []
for c in string.lowercase:
if os.path.exists('%s:/'%c):
d.append('%s:'%c)
return d
In my application, the first solution is not practical because I cannot
gurantee the user will have win32api (win32all) installed.
The second solution is perfect, except ... on some machines (and I
don't know why not on others), the attempt to check for 'a:/' causes
Windows to present a dialog demanding that you insert a floppy to
continue. The bchavior is identical if you use 'a:\\' as the test
string. This is a showstopper for my intented use. Does anyone have
a workaround or a better way to get the drive list?
------------------------------------------------------------------------------
Tim Daneliuk
tundra at tundraware.com
More information about the Python-list
mailing list