Win32 Drive List Redux
Dick.Zantow at lexisnexis.com
Thu Jan 2 19:07:47 CET 2003
"Tim Daneliuk" <tundra at tundraware.com> wrote in message
news:ert1va.ruj2.ln at boundary.tundraware.com...
> 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
> 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?
I'll ask a stupid question: do you need to know whether there are a:
or b: drives on the machine? If not, start from c:.
More information about the Python-list