Problem with os.listdir and delay with unreachable network drives onWindows

Discussion in 'Python' started by Read Roberts, Dec 22, 2004.

  1. Read Roberts

    Read Roberts Guest

    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.
    Read Roberts, Dec 22, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?UHJhZGVlcCBTdW5kYXJhbShNU0ZUKQ==?=

    Enumerate all the drives including Mapped network drives on a serv

    =?Utf-8?B?UHJhZGVlcCBTdW5kYXJhbShNU0ZUKQ==?=, Feb 25, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    1,033
    =?Utf-8?B?UHJhZGVlcCBTdW5kYXJhbShNU0ZUKQ==?=
    Feb 26, 2005
  2. kai
    Replies:
    1
    Views:
    356
  3. kai
    Replies:
    0
    Views:
    358
  4. kai
    Replies:
    0
    Views:
    305
  5. kai
    Replies:
    0
    Views:
    301
Loading...

Share This Page