[python-win32] detect mapped network path

Tim Golden tim.golden at viacom-outdoor.co.uk
Thu Jun 30 12:05:43 CEST 2005


| [Simon Dahlbacka]
| | 
| | On 6/30/05, Tim Golden <tim.golden at viacom-outdoor.co.uk> wrote:
| | > [Simon Dahlbacka]
| | > | I'm having trouble with the fact that
| | > | win32file.FindFirstChangeNotification seems to not like 
| | network paths.
| | > 
| | > I don't quite understand why this is happening, but to
| | > answer your most direct question, here's a snippet of
| | > code which may help:
| | > 
| 
| [.. snip code using NetUseEnum ..]
| 
| | thanks, I tried your code, but it seems 
| | win32net.NetUseEnum(None, 0, resume)
| | just returns ([], 0, 0) all the time !?! ..and thus it does 
| not work.
| | An ordinary "net use" issued in the cmd window yields the correct
| | information though.. (they seem to be NetWare Services 
| though, if that
| | matters?)

Or you could use WMI. The only trouble is that it seems
dreadfully slow (on my Win2K box):

<code>
import wmi

c = wmi.WMI ()
for connection in c.Win32_NetworkConnection (LocalName="G:"):
  print connection.Name
  break
else:
  print "Not a network drive"
</code>

No idea how this will interact with NetWare shares.

TJG

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________


More information about the Python-win32 mailing list