summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Vu-Brugier <cvubrugier@fastmail.fm>2019-08-01 22:23:15 +0200
committerChristophe Vu-Brugier <cvubrugier@fastmail.fm>2019-08-01 22:27:51 +0200
commit7e7912f64004cc7114566ac8fc536080171f7800 (patch)
tree8f3ce29f554bbf236863a4e37600549c3e4634c9
parent0b4fcdd0726248c5b47c8fdede331d0757a3c0b7 (diff)
downloadtargetcli-7e7912f64004cc7114566ac8fc536080171f7800.tar.gz
Fix a syntax error in some except clauses
"except Exception, e" triggers a syntax error on Python 3.7. The correct syntax is "except Exception as e". This patch fixes issue #142.
-rwxr-xr-xdaemon/targetclid2
-rwxr-xr-xscripts/targetcli4
2 files changed, 3 insertions, 3 deletions
diff --git a/daemon/targetclid b/daemon/targetclid
index 06ffbe8..98a6fd0 100755
--- a/daemon/targetclid
+++ b/daemon/targetclid
@@ -124,7 +124,7 @@ class TargetCLI:
lock = struct.pack('hhllhh', fcntl.F_UNLCK, 0, 0, 0, 0, 0)
try:
fcntl.fcntl(self.pfd, fcntl.F_SETLK, lock)
- except Exception, e:
+ except Exception as e:
self.display(
self.render(
"fcntl(UNLCK) on pidfile failed: %s" %str(e),
diff --git a/scripts/targetcli b/scripts/targetcli
index 9e03b0f..b7a2467 100755
--- a/scripts/targetcli
+++ b/scripts/targetcli
@@ -94,7 +94,7 @@ def try_op_lock(shell, lkfd):
'''
try:
fcntl.flock(lkfd, fcntl.LOCK_EX) # wait here until ongoing request is finished
- except Exception, e:
+ except Exception as e:
shell.con.display(
shell.con.render_text(
"taking lock on lockfile failed: %s" %str(e),
@@ -107,7 +107,7 @@ def release_op_lock(shell, lkfd):
'''
try:
fcntl.flock(lkfd, fcntl.LOCK_UN) # allow other requests now
- except Exception, e:
+ except Exception as e:
shell.con.display(
shell.con.render_text(
"unlock on lockfile failed: %s" %str(e),