On 29/01/2014 21:58, danz wrote:
> Tim.
> 
> I came across your code while searching for a similar need.  Your post was
> the best I could find on the subject.  Perhaps more importantly, you showed
> me that going down the ctypes rabbit hole can be less intimidating than I
> assumed.  Thanks!

[The OP appears to be replying via nabble to a tutor thread from about
18 months ago. I was the person doing most of the talking hence the
reply to me]

> 
> My use case was a little different than the original poster's.  I need to
> retrieve the network paths for all of the mapped drives that are currently
> connected.  I chose a different implementation, that seems to work well.  I
> would appreciate any comments you have on this approach.

[... snip subprocess "NET USE" + splitlines ...]

It's a perfectly reasonable approach. The usual caveats would apply:
that you're at the mercy of layout changes in "NET USE" and of i18n
changes to the "OK" text. But both of those are low risk and if it works
for you and you're in control of your environment, then it's fine.

There's something somewhat satisfying in employing the underlying API
for what should be a future-proof solution, but parsing stdout is a
well-established approach as well.

> BTW, Thank you for the information on your website.  Your information and
> pointers to GetDriveType() and GetVolumeInformation() helped me a a lot.

You're welcome. Glad it was useful.


TJG
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to