find network drives, win

Gerhard Häring gh_pythonlist at gmx.de
Mon Nov 5 12:35:07 EST 2001


On Mon, Nov 05, 2001 at 04:51:10PM +0000, Marcus Stojek wrote:
> Hi,
> 
> under windows I have to find out for a given path whether the drive is local
> or a network drive (is "mounted" the right word for this?)
> I tried:
> -----------------------------------------------
> import string
> import os.path
> [...]

I think you cannot find that out with the standard Python libraries. I propose
you get the ActivePython distribution from ActiveState or install their
Windows-Extensions, named win32all on top of your existing Python installation.

Then, check out the win32file module, and especially the GetDriveType()
function there.

Btw. the Windows extensions are *very* useful on Windows. They give you access
to a large part of the Windows API and you can use them to access most ActiveX
controls and do COM-automation of applications, such as MS Excel.

Gerhard
-- 
mail:   gerhard <at> bigfoot <dot> de       registered Linux user #64239
web:    http://www.cs.fhm.edu/~ifw00065/    OpenPGP public key id 86AB43C0
public key fingerprint: DEC1 1D02 5743 1159 CD20  A4B6 7B22 6575 86AB 43C0
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))




More information about the Python-list mailing list