Commit 35cde1fd authored by Matt Selsky's avatar Matt Selsky Committed by Matt Selsky

Fewer bare "except" in python code

int()/float() raise ValueError
open() raises IOError
parent 2c3a5889
Pipeline #28210097 passed with stages
in 3 minutes and 30 seconds
......@@ -220,7 +220,7 @@ try:
# make sure it is a temperature
temp = float(output[0])
break
except:
except ValueError:
# bad data, try aagin
fail = True
if args.verbose:
......
......@@ -39,7 +39,7 @@ zone = 0
while True:
try:
f = open('/sys/class/thermal/thermal_zone{0}/temp'.format(zone), 'r')
except:
except IOError:
break
for line in f:
temp = float(line) / 1000
......
......@@ -354,7 +354,7 @@ usage: help [ command ]
if line.startswith("&"):
try:
idx = int(line[1:].split()[0])
except:
except ValueError:
self.warn("Invalid index literal.\n")
return -1
if idx < 0 or idx >= 2**16-1:
......@@ -368,7 +368,7 @@ usage: help [ command ]
else:
try:
associd = int(line.split()[0])
except:
except ValueError:
self.warn("Invalid associd literal.\n")
return -1
if (associd != 0 and
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment