Hi guys, I've seen a few posts about this topic but could not find the solution. I am trying to connect a drive to a network drive using win32wnet.WNetAddConnection2 but I might be missing something because it does not work. This is what I have.
import os import win32api import win32wnet import win32netcon,win32wnet ynetworkPath = '\\\\LAMPSERVER_RB\\resources_server\\' znetworkPath = '\\\\LAMPSERVER\\lampserver\\_PROJECTS\\' yDrive = 'Y:' user='aa' password='bb' def mapResourcesDrive(): print ynetworkPath if (os.path.exists(yDrive)): print "Y drive is already mapped" if (os.path.exists(ynetworkPath)): print ynetworkPath, " is found..." print "Trying to map ", ynetworkPath, " on to ", yDrive, " ....." try: win32wnet.WNetAddConnection2(win32netcon.RESOURCETYPE_DISK, yDrive, ynetworkPath, None, user, password) print "connection established succesfully" except: print "Unexpected error..." return -1 print "Mapping successful" return 1 else: print "Network path unreachable..." mapResourcesDrive() If anyone can give me an idea of why win32wnet.WNetAddConnection2(win32netcon.RESOURCETYPE_DISK, yDrive, ynetworkPath, None, user, password) is not working owuld be much appreciatted. Many thanks, Joan -- https://mail.python.org/mailman/listinfo/python-list