[PATCH] Update wpaspy.py to be python3 compatible

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



commit e2e9815007ba7564c2f00106505acee47150e68a
Author: Preston Hunt <preston.hunt@xxxxxxxxx>
Date:   Mon Jan 30 17:04:34 2017 -0800

    Update wpaspy.py to be python3 compatible

    Make minor changes to wpaspy module that enables it to run in either
    python2 or python3.

    Signed-off-by: Preston Hunt <preston.hunt@xxxxxxxxx>

diff --git a/wpaspy/wpaspy.py b/wpaspy/wpaspy.py
index c2aace0..5f614c7 100644
--- a/wpaspy/wpaspy.py
+++ b/wpaspy/wpaspy.py
@@ -6,6 +6,8 @@
 # This software may be distributed under the terms of the BSD license.
 # See README for more details.

+from __future__ import print_function
+
 import os
 import stat
 import socket
@@ -38,7 +40,7 @@ class Ctrl:
             self.s.bind(self.local)
             try:
                 self.s.connect(self.dest)
-            except Exception, e:
+            except Exception as e:
                 self.s.close()
                 os.unlink(self.local)
                 raise
@@ -57,7 +59,7 @@ class Ctrl:
                 self.cookie = reply
                 self.port = port
             except:
-                print "connect exception ", path, str(port)
+                print("connect exception ", path, str(port))
                 if self.s != None:
                     self.s.close()
                 raise
@@ -70,7 +72,7 @@ class Ctrl:
         if self.attached:
             try:
                 self.detach()
-            except Exception, e:
+            except Exception as e:
                 # Need to ignore this allow the socket to be closed
                 self.attached = False
                 pass
@@ -114,7 +116,7 @@ class Ctrl:
         if self.attached:
             try:
                 self.detach()
-            except Exception, e:
+            except Exception as e:
                 # Need to ignore this to allow the socket to be closed
                 self.attached = False
         self.request("TERMINATE")


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux