On 6/30/05, Tim Golden <[EMAIL PROTECTED]> wrote: > [Simon Dahlbacka] > | I'm having trouble with the fact that > | win32file.FindFirstChangeNotification seems to not like network paths. > | (Or at least that is what I concluded after getting the following > | traceback) > | > | Traceback (most recent call last): > | File "C:\Python23\lib\threading.py", line 436, in __bootstrap > | self.run() > | File > | "c:\GSP\Instr\Common\Utilities\LogBrowser\LogFileReaderThread.py", > | line 59, in run > | False, FILE_NOTIFY_CHANGE_SIZE) > | error: (1, 'FindFirstChangeNotification', 'Incorrect function.') > | > | > | Now, I what to indicate to the user that this is not possible. A > | direct UNC path is no problem \\foo\bar\blarg.baz > | > | ..but how do i find out if let's say X:\foo\bar\blarg.baz is a local > | path or in fact a mapped network path? > > 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: > > <code> > import win32net > > def mapped_drives (): > drives = {} > resume = 0 > while 1: > (_drives, total, resume) = win32net.NetUseEnum (None, 0, resume) > for drive in _drives: > if drive['local']: > yield drive['local'], drive['remote'] > if not resume: break > > for letter, mapping in mapped_drives (): > if mapping == r"\\voapps\d": > print letter > break > </code>
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?) /Simon _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32