From: Anirudha Bose Date: Fri, 19 Aug 2016 05:23:53 +0000 (+0530) Subject: qa/workunits: Python 3 compat fixes for fs/misc/filelock_interrupt.py X-Git-Tag: v11.0.1~182^2~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b8233cc77e310c38eafc21c97a0d33c7e685045b;p=ceph.git qa/workunits: Python 3 compat fixes for fs/misc/filelock_interrupt.py Signed-off-by: Anirudha Bose --- diff --git a/qa/workunits/fs/misc/filelock_interrupt.py b/qa/workunits/fs/misc/filelock_interrupt.py index a17fa39e9dc..3ce559e09c3 100755 --- a/qa/workunits/fs/misc/filelock_interrupt.py +++ b/qa/workunits/fs/misc/filelock_interrupt.py @@ -29,7 +29,7 @@ def main(): signal.alarm(5); try: fcntl.flock(f2, fcntl.LOCK_EX) - except IOError, e: + except IOError as e: if e.errno != errno.EINTR: raise else: @@ -40,11 +40,11 @@ def main(): lockdata = struct.pack('hhllhh', fcntl.F_WRLCK, 0, 0, 10, 0, 0) try: fcntl.fcntl(f1, fcntl.F_OFD_SETLK, lockdata) - except IOError, e: + except IOError as e: if e.errno != errno.EINVAL: raise else: - print 'kernel does not support fcntl.F_OFD_SETLK' + print('kernel does not support fcntl.F_OFD_SETLK') return lockdata = struct.pack('hhllhh', fcntl.F_WRLCK, 0, 10, 10, 0, 0) @@ -58,7 +58,7 @@ def main(): try: lockdata = struct.pack('hhllhh', fcntl.F_WRLCK, 0, 0, 0, 0, 0) fcntl.fcntl(f2, fcntl.F_OFD_SETLKW, lockdata) - except IOError, e: + except IOError as e: if e.errno != errno.EINTR: raise else: @@ -70,7 +70,7 @@ def main(): try: lockdata = struct.pack('hhllhh', fcntl.F_WRLCK, 0, 10, 10, 0, 0) fcntl.fcntl(f1, fcntl.F_OFD_SETLK, lockdata) - except IOError, e: + except IOError as e: if e.errno == errno.EAGAIN: pass else: @@ -80,6 +80,7 @@ def main(): fcntl.fcntl(f1, fcntl.F_OFD_SETLK, lockdata) fcntl.fcntl(f2, fcntl.F_OFD_SETLK, lockdata) - print 'ok' + print('ok') + main()