summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuke Macken <lmacken@redhat.com>2008-05-17 01:44:46 -0400
committerLuke Macken <lmacken@redhat.com>2008-05-17 01:44:46 -0400
commit199ac3c57f63473987290eedba15660ea5e7953b (patch)
treecd2cb50fc8fee5064df1dfbedb2af914f8777677
parent65fa522cee67fc8727f8dcdbb620b94340b57954 (diff)
Catch all exceptions in _getDeviceUUID, and fallback to dealing with labels.
-rwxr-xr-xliveusb/creator.py25
1 files changed, 14 insertions, 11 deletions
diff --git a/liveusb/creator.py b/liveusb/creator.py
index c31f7ce..d0657ba 100755
--- a/liveusb/creator.py
+++ b/liveusb/creator.py
@@ -307,17 +307,20 @@ class WindowsLiveUSBCreator(LiveUSBCreator):
def _getDeviceUUID(self):
""" Return the UUID of our selected drive """
if not self.uuid:
- import win32com.client
- wmi = win32com.client.GetObject("winmgmts:")
- result = wmi.ExecQuery('SELECT VolumeSerialNumber FROM '
- 'Win32_LogicalDisk WHERE Name="%s"' %
- self.drive)
- if result and len(result):
- uuid = str(result[0].Properties_("VolumeSerialNumber"))
- if uuid == 'None':
- self.uuid = None
- else:
- self.uuid = uuid[:4] + '-' + uuid[4:]
+ try:
+ import win32com.client
+ wmi = win32com.client.GetObject("winmgmts:")
+ result = wmi.ExecQuery('SELECT VolumeSerialNumber FROM '
+ 'Win32_LogicalDisk WHERE Name="%s"' %
+ self.drive)
+ if result and len(result):
+ uuid = str(result[0].Properties_("VolumeSerialNumber"))
+ if uuid == 'None':
+ self.uuid = None
+ else:
+ self.uuid = uuid[:4] + '-' + uuid[4:]
+ except:
+ self.uuid = None
return self.uuid
# vim:ts=4 sw=4 expandtab: