[Tutor] getUncPath(mappedDrive)

Albert-Jan Roskam fomcl at yahoo.com
Sat Mar 24 22:29:43 CET 2012

From: Tim Golden <mail at timgolden.me.uk>
>Cc: Python Mailing List <tutor at python.org> 
>Sent: Saturday, March 24, 2012 9:22 PM
>Subject: Re: [Tutor] getUncPath(mappedDrive)
>On 24/03/2012 20:13, Albert-Jan Roskam wrote:
>> Hi,
>> Is there a function that takes a file path with a mapped drive
>> (z:\blah) and returns the associated UNC path
>> (\\server\share\ding\dang\dong\blah)? I looked in os.path, but it
>> doesn't seem to have this. The link below seems to be a solution
>> (code in the bottom of the page), but I can't install win32com.client
>> in the office :-( Is there any built-in function?
>> http://stackoverflow.com/questions/2244767/python-check-network-map
>There's nothing built-in. The easiest function to emulate
>through ctypes is probably WNetGetConnection:
>(this is available from pywin32 via the win32wnet package
>but I assume you can't install that either)
>Hi Tim,
>Thanks! This seems a feasible approach. I have found this Python project that exposes some of the functions of mpr.dll: http://sourceforge.net/projects/wnetconnect/ WNetGetConnection is not among the functions, but the code will help. I have to read up on ctypes.Structure though as I never really understood this.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120324/d2cf9751/attachment.html>

More information about the Tutor mailing list