Fix python3 exception when ctrl-c tools/trace.py
authorBrenden Blanco <bblanco@plumgrid.com>
Fri, 8 Apr 2016 22:52:55 +0000 (15:52 -0700)
committerBrenden Blanco <bblanco@plumgrid.com>
Sun, 10 Apr 2016 04:24:42 +0000 (21:24 -0700)
The way to do exception printing in python2/3 compatible way is using
sys.exc_info()[0/1].

tools/trace.py

index aca1b27..62d3143 100755 (executable)
@@ -545,8 +545,8 @@ trace 'u:pthread:pthread_create (arg4 != 0)'
                 except:
                         if self.args.verbose:
                                 traceback.print_exc()
-                        elif sys.exc_type is not SystemExit:
-                                print(sys.exc_value)
+                        elif sys.exc_info()[0] is not SystemExit:
+                                print(sys.exc_info()[1])
                 self._close_probes()
 
 if __name__ == "__main__":