Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 1 | From c98fee41d130cb946aa4e60fefaa6cbf203f6790 Mon Sep 17 00:00:00 2001 |
| 2 | From: Jason Wessel <jason.wessel@windriver.com> |
| 3 | Date: Thu, 29 Jun 2017 20:33:23 -0700 |
| 4 | Subject: [PATCH 2/8] Python3 compatibility: exception cleanup |
| 5 | |
| 6 | Commit 52e4a477f0b3c0a0ece7adeede6e06e07814f8b9 from |
| 7 | https://github.com/openvswitch/ovs.git |
| 8 | |
| 9 | The exception syntax which is compatible with python2 and python3 is |
| 10 | to use the "as" form for "except:". |
| 11 | |
| 12 | Signed-off-by: Jason Wessel <jason.wessel@windriver.com> |
| 13 | Signed-off-by: Ben Pfaff <blp@ovn.org> |
| 14 | --- |
| 15 | build-aux/extract-ofp-fields | 2 +- |
| 16 | ovsdb/ovsdb-doc | 4 ++-- |
| 17 | ovsdb/ovsdb-idlc.in | 4 ++-- |
| 18 | 3 files changed, 5 insertions(+), 5 deletions(-) |
| 19 | |
| 20 | diff --git a/build-aux/extract-ofp-fields b/build-aux/extract-ofp-fields |
| 21 | index 425a85f..61e752b 100755 |
| 22 | --- a/build-aux/extract-ofp-fields |
| 23 | +++ b/build-aux/extract-ofp-fields |
| 24 | @@ -784,7 +784,7 @@ if __name__ == "__main__": |
| 25 | try: |
| 26 | options, args = getopt.gnu_getopt(sys.argv[1:], 'h', |
| 27 | ['help', 'ovs-version=']) |
| 28 | - except getopt.GetoptError, geo: |
| 29 | + except getopt.GetoptError as geo: |
| 30 | sys.stderr.write("%s: %s\n" % (argv0, geo.msg)) |
| 31 | sys.exit(1) |
| 32 | |
| 33 | diff --git a/ovsdb/ovsdb-doc b/ovsdb/ovsdb-doc |
| 34 | index b34fb11..918e88a 100755 |
| 35 | --- a/ovsdb/ovsdb-doc |
| 36 | +++ b/ovsdb/ovsdb-doc |
| 37 | @@ -278,7 +278,7 @@ if __name__ == "__main__": |
| 38 | options, args = getopt.gnu_getopt(sys.argv[1:], 'hV', |
| 39 | ['er-diagram=', |
| 40 | 'version=', 'help']) |
| 41 | - except getopt.GetoptError, geo: |
| 42 | + except getopt.GetoptError as geo: |
| 43 | sys.stderr.write("%s: %s\n" % (argv0, geo.msg)) |
| 44 | sys.exit(1) |
| 45 | |
| 46 | @@ -306,7 +306,7 @@ if __name__ == "__main__": |
| 47 | if len(line): |
| 48 | print(line) |
| 49 | |
| 50 | - except error.Error, e: |
| 51 | + except error.Error as e: |
| 52 | sys.stderr.write("%s: %s\n" % (argv0, e.msg)) |
| 53 | sys.exit(1) |
| 54 | |
| 55 | diff --git a/ovsdb/ovsdb-idlc.in b/ovsdb/ovsdb-idlc.in |
| 56 | index 1064448..8b85f0d 100755 |
| 57 | --- a/ovsdb/ovsdb-idlc.in |
| 58 | +++ b/ovsdb/ovsdb-idlc.in |
| 59 | @@ -1098,7 +1098,7 @@ if __name__ == "__main__": |
| 60 | ['directory', |
| 61 | 'help', |
| 62 | 'version']) |
| 63 | - except getopt.GetoptError, geo: |
| 64 | + except getopt.GetoptError as geo: |
| 65 | sys.stderr.write("%s: %s\n" % (argv0, geo.msg)) |
| 66 | sys.exit(1) |
| 67 | |
| 68 | @@ -1136,7 +1136,7 @@ if __name__ == "__main__": |
| 69 | sys.exit(1) |
| 70 | |
| 71 | func(*args[1:]) |
| 72 | - except ovs.db.error.Error, e: |
| 73 | + except ovs.db.error.Error as e: |
| 74 | sys.stderr.write("%s: %s\n" % (argv0, e)) |
| 75 | sys.exit(1) |
| 76 | |
| 77 | -- |
| 78 | 2.5.0 |
| 79 | |