From 17ddcaa9df52cefd62da07a25c851e96e058e4f6 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 20 Jan 2016 13:00:22 +0530 Subject: [PATCH] ... --- src/calibre/devices/winusb.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/calibre/devices/winusb.py b/src/calibre/devices/winusb.py index 306cc09173..56cb59ba54 100644 --- a/src/calibre/devices/winusb.py +++ b/src/calibre/devices/winusb.py @@ -761,9 +761,19 @@ def get_storage_number_map_alt(debug=False): for devinfo, devpath in DeviceSet().interfaces(): if not devpath.endswith(os.sep): devpath += os.sep - GetVolumeNameForVolumeMountPoint(devpath, wbuf, len(wbuf)) + try: + GetVolumeNameForVolumeMountPoint(devpath, wbuf, len(wbuf)) + except WindowsError as err: + if debug: + prints('Failed to get volume id for drive: %s with error: %s' % (devpath, as_unicode(err))) + continue vname = wbuf.value - wbuf, names = get_volume_pathnames(vname, buf=wbuf) + try: + wbuf, names = get_volume_pathnames(vname, buf=wbuf) + except WindowsError as err: + if debug: + prints('Failed to get mountpoints for volume %s with error: %s' % (devpath, as_unicode(err))) + continue for name in names: name = name.upper() if len(name) == 3 and name.endswith(':\\') and name[0] in string.ascii_uppercase: