<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><br> <div><br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; margin-top: 5px; padding-left: 5px;"><div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"><div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"><div dir="ltr"><font face="Arial" size="2"><b><span style="font-weight:bold;">From:</span></b> Tim Golden &lt;mail@timgolden.me.uk&gt;<br> <b><span style="font-weight: bold;">To:</span></b>  <br><b><span style="font-weight: bold;">Cc:</span></b> Python Mailing List &lt;tutor@python.org&gt; <br> <b><span style="font-weight: bold;">Sent:</span></b> Saturday, March 24, 2012 9:22 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [Tutor] getUncPath(mappedDrive)<br> </font> </div> <br>
On 24/03/2012 20:13, Albert-Jan Roskam wrote:<br>&gt; Hi,<br>&gt;<br>&gt; Is there a function that takes a file path with a mapped drive<br>&gt; (z:\blah) and returns the associated UNC path<br>&gt; (\\server\share\ding\dang\dong\blah)? I looked in os.path, but it<br>&gt; doesn't seem to have this. The link below seems to be a solution<br>&gt; (code in the bottom of the page), but I can't install win32com.client<br>&gt; in the office :-( Is there any built-in function?<br>&gt;<br>&gt; http://stackoverflow.com/questions/2244767/python-check-network-map<br><br>There's nothing built-in. The easiest function to emulate<br>through ctypes is probably WNetGetConnection:<br><br>http://msdn.microsoft.com/en-us/library/windows/desktop/aa385453%28v=vs.85%29.aspx<br><br>(this is available from pywin32 via the win32wnet package<br>but I assume you can't install that either)<br><br>TJG<br>_______________________________________________<br>Hi Tim,<br><br>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.<br><br>Cheers,<br>Albert-Jan<br><br><br> </div> </div> </blockquote>  </div></div></body></html>