Win32 Drive List Redux

Tim Daneliuk tundra at
Thu Jan 2 18:50:06 CET 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:


And Ken Seehof suggested:

def drives():
     d = []
     for c in string.lowercase:
         if os.path.exists('%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

More information about the Python-list mailing list