hello,
AFAIK it's not allowed to connect a network share more than once.
As my shares can already be connected through by another program,
I need to detect if a network share is already connected,
So I try to get a list of available network shares,
but I don't see the network shares, although they are available.
Attempt 1:
import wmi
c = wmi.WMI ()
for share in c.Win32_Share ():
print 'SSSSSSSSSSSSS', share.Name, share.Path
Attempt 2:
import win32net
import win32netcon
COMPUTER_NAME = "" # look at this machine
INFO_LEVEL = 2
resume = 0
while 1:
(shares, total, resume) = \
win32net.NetShareEnum (
COMPUTER_NAME,
INFO_LEVEL,
resume,
win32netcon.MAX_PREFERRED_LENGTH
)
for share in shares:
print 'PPPPPP', share['netname'], "=>", share['path']
if not resume:
break
A workaround, that seems to work correctly :
try :
os.path.exists ( Share_Name )
return True
except :
print 'NNNNOOOOOOOOOOOOOOOOOPP', Share_Name
... otherwise try to connect the share
Any better ideas ?
thanks,
Stef Mientki
_______________________________________________
python-win32 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-win32