Help! Problems with win32wnet.WNetAddConnection2
Dan Rolander
dan.rolander at marriott.com
Wed Feb 14 09:56:34 EST 2001
I am using the following function to break any existing connections between
a local drive and a network share and create a new one. It works just fine
on Windows 2000, but on Windows 98 both WNetCancelConnection2 and
WNetAddConnection2 return the following pywintypes.api_error:
'The network request is not supported.'
This should work on Windows 98 shouldn't it? What am I doing wrong?
def map(drive, unc, username=None, password=None, persistent='no'):
if persistent == 'yes':
flags = win32netcon.CONNECT_UPDATE_PROFILE
else:
flags = 0
drive_type = win32file.GetDriveType(drive)
if drive_type == win32con.DRIVE_REMOTE:
win32wnet.WNetCancelConnection2(drive, flags, 1)
win32wnet.WNetAddConnection2(
win32netcon.RESOURCETYPE_DISK,
drive,
unc,
None,
username,
password,
flags
)
More information about the Python-list
mailing list