From: ghost Date: Mon, 19 Jan 2009 10:12:54 +0000 (+0100) Subject: use OSError instead of IOError and small fix for sr devices X-Git-Tag: 2.6.0~502 X-Git-Url: https://git.cweiske.de/enigma2.git/commitdiff_plain/0621e74942fa09f300e8b63d5e586db4575ba180 use OSError instead of IOError and small fix for sr devices --- diff --git a/lib/python/Components/Harddisk.py b/lib/python/Components/Harddisk.py index 8e30a512..d739e984 100644 --- a/lib/python/Components/Harddisk.py +++ b/lib/python/Components/Harddisk.py @@ -351,12 +351,15 @@ class HarddiskManager: def addHotplugPartition(self, device, physdev = None): if not physdev: dev, part = self.splitDeviceName(device) - physdev = dev try: - import os - physdev = os.readlink("/sys/block/" + dev + "/device")[6:] - except IOError: - print "couldn't determine blockdev physdev for device", dev + physdev = readlink("/sys/block/" + dev + "/device")[6:] + except OSError: + print "couldn't determine blockdev physdev for device", dev, "try", device, "now" + try: + physdev = readlink("/sys/block/" + device + "/device")[6:] + except OSError: + physdev = dev + print "couldn't determine blockdev physdev for device", device # device is the device name, without /dev # physdev is the physical device path, which we (might) use to determine the userfriendly name