Problem with win32net on Windows 2K
I am trying to use win32net on a Windows 2000 Japanese system, and discover that it won't import. I found a message describing the problem (see below) but can't find any response, and don't see a bug report on the SourceForge site for this. . Can anyone tell me if this has ben fixed? An early message in 2000 said that win32net is supposed to run on Windows 2000 I find the same problem reported, with more detail, on the py2exe user list, where Thomas Heller commented on 2004-08-26 : Here"s the rest of the trackback: > File "netbios.pyc", line 1, in ? > File "win32wnet.pyc", line 9, in ? > File "win32wnet.pyc", line 7, in __load > ImportError: DLL load failed: The specified procedure could not be found. The procedure entry point LsaLookupNames2 could not be located in the dynamic link library ADVAPI32.dll This looks like the win32net Python extension requires the LsaLookupNames2 function in ADVAPI32, but this is only available in WinXP and Win2003 Server, according to MSDN, preventing to use win32net on win2k. You should report this to Mark Hammond, and maybe use a later version of pywin32 for now. Thomas -- http://mail.python.org/mailman/listinfo/python-list
Problem with os.listdir and delay with unreachable network drives on Windows
I wrote my own directory browser in order to get around a bug where tkFileDialog.askdirectory() can't handle non-ascii paths. However, I have a problem where I call os.listdir() on a mapped network drive, e.g. os.listdir("Z:\\"), and if the network drive is unavailable, the UI hangs until the OS returns with an exception because the network shared drive is unavailable. I would like to work around this by simply not looking into mapped drives that are not currently mounted. Is there some way to check the status of mapped drive to see if it is currently mounted, or a better solution? ( I use the call win32api.GetLogicalDriveStrings() to get the list of available drives). Also, is there any way to enumerate remote volumes that are mounted by not mapped? I can't easily find this in the win32 stuff or via googling. The win32net calls to enumerate servers and shares sound likely, but don't show such volumes on my system, although I may not be using the right arguments. I have the current Windows binary install of Python 2.3.4 on my Windows XP system. -- http://mail.python.org/mailman/listinfo/python-list
Re: Problem with os.listdir and delay with unreachable network drives on Windows
Thank you for your response - this was very helpful. I find that 'win32net.NetGetUseInfo()' does not deal with UNC names - it seems to require a drive specification in the form of a single letter. The following sequence worked well for me, resulting in a much shorter 'hang time' for unreachable network mapped drives than simply calling gos.listdir() # get list of logical drive strginsdrive strings volumeList = win32api.GetLogicalDriveStrings().split("\000")[:-1] # some time later... # vol is an entry in the volumeList. driveLetter= vol[0] dirList = [] if win32file.DRIVE_REMOTE = win32file.GetDriveType(driveLetter): try: driveStatus = win32net.NetUseGetInfo(None, driveLetter, 3) if driveStatus['status'] == 0: dirList = os.listdir(vol) else: # tell user the selected drive is not available. except pywinypes.error(e) # tell user the selected drive is not available # happens when drive letter is not one # of the current logical drives From: Andrey Ivanov <[EMAIL PROTECTED]> - Find messages by this author Date: Thu, 23 Dec 2004 11:44:17 +0300 Local: Thurs, Dec 23 2004 12:44 am Subject: Re: Problem with os.listdir and delay with unreachable network drives on Windows Reply | Reply to Author | Forward | Print | Individual Message | Show original | Report Abuse [Read Roberts] - Show quoted text - Maybe a win32net.WNetGetUniversalName() [expands drive to UNC name] and win32net.NetGetUseInfo() [returns various info on UNC name including status] will help you. I don't have a time to setup shares, so I can't guarantee that this approach will work as you expect. First function might raise an exception on disconnected devices, which you will need to handle. You might also need win32file.GetDriveType() to distinguish between remote and local drives. -- Andrey -- http://mail.python.org/mailman/listinfo/python-list