diff options
author | Matthew Thode <[email protected]> | 2013-11-08 15:53:54 -0600 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2013-11-08 14:30:29 -0800 |
commit | 09d672d331377e5764bc94b3362c35481ae96a52 (patch) | |
tree | 089373342839a11012a06f55e40fb29726495d10 /cmd/arcstat/arcstat.py | |
parent | 23bc1f91fc5694699750be6343070e0d16fbe4ea (diff) |
Python 3 fixes
Future proofing for compatibility with newer versions of Python.
Signed-off-by: Matthew Thode <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Issue #1838
Diffstat (limited to 'cmd/arcstat/arcstat.py')
-rwxr-xr-x | cmd/arcstat/arcstat.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/cmd/arcstat/arcstat.py b/cmd/arcstat/arcstat.py index 24f4aa77e..2b5ac76f5 100755 --- a/cmd/arcstat/arcstat.py +++ b/cmd/arcstat/arcstat.py @@ -191,7 +191,7 @@ def prettynum(sz, scale, num=0): return "%s" % num # Rounding error, return 0 - elif num > 0 and num < 1: + elif 0 < num < 1: num = 0 while num > scale and index < 5: @@ -259,10 +259,10 @@ def init(): "columns" ] ) - - except getopt.error, msg: + except getopt.error as msg: sys.stderr.write(msg) usage() + opts = None for opt, arg in opts: if opt in ('-x', '--extended'): @@ -335,7 +335,7 @@ def init(): out = open(opfile, "w") sys.stdout = out - except: + except IOError: sys.stderr.write("Cannot open %s for writing\n" % opfile) sys.exit(1) @@ -345,7 +345,7 @@ def calculate(): global v global l2exist - v = {} + v = dict() v["time"] = time.strftime("%H:%M:%S", time.localtime()) v["hits"] = d["hits"] / sint v["miss"] = d["misses"] / sint @@ -398,7 +398,7 @@ def calculate(): v["l2bytes"] = d["l2_read_bytes"] / sint -def sighandler(*args): +def sighandler(): sys.exit(0) |