python: Fix exception handler compatibility.
[cascardo/ovs.git] / utilities / ovs-pcap.in
index 8ab4756..ed35fc5 100755 (executable)
@@ -1,6 +1,6 @@
 #! @PYTHON@
 #
-# Copyright (c) 2010 Nicira Networks.
+# Copyright (c) 2010 Nicira, Inc.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -19,9 +19,11 @@ import getopt
 import struct
 import sys
 
+
 class PcapException(Exception):
     pass
 
+
 class PcapReader(object):
     def __init__(self, file_name):
         self.file = open(file_name, "rb")
@@ -53,6 +55,7 @@ class PcapReader(object):
         return packet
 argv0 = sys.argv[0]
 
+
 def usage():
     print """\
 %(argv0)s: print pcap file packet data as hex
@@ -70,7 +73,7 @@ if __name__ == "__main__":
         try:
             options, args = getopt.gnu_getopt(sys.argv[1:], 'hV',
                                               ['help', 'version'])
-        except getopt.GetoptException, geo:
+        except getopt.GetoptException as geo:
             sys.stderr.write("%s: %s\n" % (argv0, geo.msg))
             sys.exit(1)
 
@@ -95,7 +98,7 @@ if __name__ == "__main__":
 
             print binascii.hexlify(packet)
 
-    except PcapException, e:
+    except PcapException as e:
         sys.stderr.write("%s: %s\n" % (argv0, e))
         sys.exit(1)