]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Use python3 compatible "except" statement
authorMasashi Honma <masashi.honma@gmail.com>
Thu, 24 Jan 2019 07:45:41 +0000 (16:45 +0900)
committerJouni Malinen <j@w1.fi>
Sat, 26 Jan 2019 10:11:35 +0000 (12:11 +0200)
This patch is made by using 2to3 command.

$ find . -name *.py | xargs 2to3 -f except -w -n

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
55 files changed:
hostapd/wps-ap-nfc.py
tests/hwsim/fst_module_aux.py
tests/hwsim/hwsim.py
tests/hwsim/hwsim_utils.py
tests/hwsim/p2p_utils.py
tests/hwsim/run-tests.py
tests/hwsim/test_ap_ciphers.py
tests/hwsim/test_ap_dynamic.py
tests/hwsim/test_ap_eap.py
tests/hwsim/test_ap_ft.py
tests/hwsim/test_ap_hs20.py
tests/hwsim/test_ap_open.py
tests/hwsim/test_ap_params.py
tests/hwsim/test_ap_pmf.py
tests/hwsim/test_ap_tdls.py
tests/hwsim/test_ap_vht.py
tests/hwsim/test_ap_vlan.py
tests/hwsim/test_ap_wps.py
tests/hwsim/test_dbus.py
tests/hwsim/test_dbus_old.py
tests/hwsim/test_fils.py
tests/hwsim/test_fst_config.py
tests/hwsim/test_fst_module.py
tests/hwsim/test_hostapd_oom.py
tests/hwsim/test_ibss.py
tests/hwsim/test_macsec.py
tests/hwsim/test_mbo.py
tests/hwsim/test_ocv.py
tests/hwsim/test_p2p_channel.py
tests/hwsim/test_rfkill.py
tests/hwsim/test_rrm.py
tests/hwsim/test_wext.py
tests/hwsim/test_wmediumd.py
tests/hwsim/test_wnm.py
tests/hwsim/test_wpas_ctrl.py
tests/hwsim/test_wpas_mesh.py
tests/hwsim/test_wpas_wmm_ac.py
tests/hwsim/tshark.py
tests/hwsim/wlantest.py
tests/hwsim/wpasupplicant.py
tests/remote/run-tests.py
wpa_supplicant/examples/dpp-qrcode.py
wpa_supplicant/examples/p2p-nfc.py
wpa_supplicant/examples/p2p/p2p_connect.py
wpa_supplicant/examples/p2p/p2p_disconnect.py
wpa_supplicant/examples/p2p/p2p_find.py
wpa_supplicant/examples/p2p/p2p_flush.py
wpa_supplicant/examples/p2p/p2p_group_add.py
wpa_supplicant/examples/p2p/p2p_invite.py
wpa_supplicant/examples/p2p/p2p_listen.py
wpa_supplicant/examples/p2p/p2p_stop_find.py
wpa_supplicant/examples/wpas-dbus-new.py
wpa_supplicant/examples/wpas-test.py
wpa_supplicant/examples/wps-nfc.py
wpaspy/test.py

index 2fc301296e882dfe113e085154fa7d6818df5445..9e24d6088b17fa0536f8bee18dba71791025fa17 100755 (executable)
@@ -42,7 +42,7 @@ def wpas_connect():
     if os.path.isdir(wpas_ctrl):
         try:
             ifaces = [os.path.join(wpas_ctrl, i) for i in os.listdir(wpas_ctrl)]
-        except OSError, error:
+        except OSError as error:
             print "Could not find hostapd: ", error
             return None
 
@@ -54,7 +54,7 @@ def wpas_connect():
         try:
             wpas = wpaspy.Ctrl(ctrl)
             return wpas
-        except Exception, e:
+        except Exception as e:
             pass
     return None
 
@@ -134,7 +134,7 @@ class HandoverServer(nfc.handover.HandoverServer):
         summary("HandoverServer - request received")
         try:
             print "Parsed handover request: " + request.pretty()
-        except Exception, e:
+        except Exception as e:
             print e
         print str(request).encode("hex")
 
@@ -161,7 +161,7 @@ class HandoverServer(nfc.handover.HandoverServer):
         print "Handover select:"
         try:
             print sel.pretty()
-        except Exception, e:
+        except Exception as e:
             print e
         print str(sel).encode("hex")
 
@@ -236,7 +236,7 @@ def rdwr_connected(tag):
         print "NDEF tag: " + tag.type
         try:
             print tag.ndef.message.pretty()
-        except Exception, e:
+        except Exception as e:
             print e
         success = wps_tag_read(tag)
         if only_one and success:
@@ -324,7 +324,7 @@ def main():
                                    llcp={'on-startup': llcp_startup,
                                          'on-connect': llcp_connected}):
                     break
-            except Exception, e:
+            except Exception as e:
                 print "clf.connect failed"
 
             global srv
index 9fd838fd5a634a1d379ff385fbfe54b251e0b890..d929134e018017808883b4dad317cf2f99662d96 100644 (file)
@@ -629,7 +629,7 @@ class FstAP (FstDevice):
             self.remove_all_sessions()
             try:
                 self.send_iface_detach_request(self.iface)
-            except Exception, e:
+            except Exception as e:
                 logger.info(str(e))
         self.reg_ctrl.stop()
         del self.global_instance
index e21c814f2e8e6928a61ac09d34b72d14884b2bdb..23bfe32e98ca439c77794efe453fffaf633e1d55 100644 (file)
@@ -65,7 +65,7 @@ class HWSimRadio(object):
             raise Exception("Failed to create radio (err:%d)" % self._radio_id)
         try:
             iface = os.listdir('/sys/class/mac80211_hwsim/hwsim%d/net/' % self._radio_id)[0]
-        except Exception,e:
+        except Exception as e:
             self._controller.destroy_radio(self._radio_id)
             raise e
         return self._radio_id, iface
index 718d53f464e762f68ea03da5c1af9ddcf44b0c4b..8ad08fcd57671e60948fe8cf9af86b3a59db4dd4 100644 (file)
@@ -198,7 +198,7 @@ def test_connectivity(dev1, dev2, dscp=None, tos=None, max_tries=1,
                                   broadcast=broadcast, send_len=send_len)
             success = True
             break
-        except Exception, e:
+        except Exception as e:
             last_err = e
             if i + 1 < max_tries:
                 time.sleep(1)
index f72865253b701e5d6e9fa8098d954db0569c240b..1a4646dc70eddaf4304ae7dba898f63b2abcf066 100644 (file)
@@ -227,7 +227,7 @@ def go_neg_init(i_dev, r_dev, pin, i_method, i_intent, res):
     try:
         i_res = i_dev.p2p_go_neg_init(r_dev.p2p_dev_addr(), pin, i_method, timeout=20, go_intent=i_intent)
         logger.debug("i_res: " + str(i_res))
-    except Exception, e:
+    except Exception as e:
         i_res = None
         logger.info("go_neg_init thread caught an exception from p2p_go_neg_init: " + str(e))
     res.put(i_res)
@@ -305,7 +305,7 @@ def go_neg_init_pbc(i_dev, r_dev, i_intent, res, freq, provdisc):
                                       timeout=20, go_intent=i_intent, freq=freq,
                                       provdisc=provdisc)
         logger.debug("i_res: " + str(i_res))
-    except Exception, e:
+    except Exception as e:
         i_res = None
         logger.info("go_neg_init_pbc thread caught an exception from p2p_go_neg_init: " + str(e))
     res.put(i_res)
index 4f5fb4e09ca228e1719f85196ab150939da4b828..1649f3fdbf0af037bb2882f31a8d95df8032bf39 100755 (executable)
@@ -47,7 +47,7 @@ def reset_devs(dev, apdev):
     for d in dev:
         try:
             d.reset()
-        except Exception, e:
+        except Exception as e:
             logger.info("Failed to reset device " + d.ifname)
             print str(e)
             ok = False
@@ -59,7 +59,7 @@ def reset_devs(dev, apdev):
         for iface in ifaces:
             if iface.startswith("wlan"):
                 wpas.interface_remove(iface)
-    except Exception, e:
+    except Exception as e:
         pass
     if wpas:
         wpas.close_ctrl()
@@ -74,7 +74,7 @@ def reset_devs(dev, apdev):
         hapd.remove('wlan3-2')
         for ap in apdev:
             hapd.remove(ap['ifname'])
-    except Exception, e:
+    except Exception as e:
         logger.info("Failed to remove hostapd interface")
         print str(e)
         ok = False
@@ -93,7 +93,7 @@ def add_log_file(conn, test, run, type, path):
     try:
         conn.execute(sql, params)
         conn.commit()
-    except Exception, e:
+    except Exception as e:
         print "sqlite: " + str(e)
         print "sql: %r" % (params, )
 
@@ -112,7 +112,7 @@ def report(conn, prefill, build, commit, run, test, result, duration, logdir,
             conn.execute(sql, params)
             if sql_commit:
                 conn.commit()
-        except Exception, e:
+        except Exception as e:
             print "sqlite: " + str(e)
             print "sql: %r" % (params, )
 
@@ -180,7 +180,7 @@ def rename_log(logdir, basename, testname, dev):
         if dev:
             dev.relog()
             subprocess.call(['chown', '-f', getpass.getuser(), srcname])
-    except Exception, e:
+    except Exception as e:
         logger.info("Failed to rename log files")
         logger.info(e)
 
@@ -303,7 +303,7 @@ def main():
                 params = (name, t.__doc__)
                 try:
                     conn.execute(sql, params)
-                except Exception, e:
+                except Exception as e:
                     print "sqlite: " + str(e)
                     print "sql: %r" % (params,)
         if conn:
@@ -477,7 +477,7 @@ def main():
                     if not d.global_ping():
                         raise Exception("Global PING failed for {}".format(d.ifname))
                     d.request("NOTE TEST-START " + name)
-                except Exception, e:
+                except Exception as e:
                     logger.info("Failed to issue TEST-START before " + name + " for " + d.ifname)
                     logger.info(e)
                     print "FAIL " + name + " - could not start test"
@@ -522,15 +522,15 @@ def main():
                                 print "Country code remains set - expect following test cases to fail"
                                 logger.info("Country code remains set - expect following test cases to fail")
                             break
-            except HwsimSkip, e:
+            except HwsimSkip as e:
                 logger.info("Skip test case: %s" % e)
                 result = "SKIP"
-            except NameError, e:
+            except NameError as e:
                 import traceback
                 logger.info(e)
                 traceback.print_exc()
                 result = "FAIL"
-            except Exception, e:
+            except Exception as e:
                 import traceback
                 logger.info(e)
                 traceback.print_exc()
@@ -542,7 +542,7 @@ def main():
                 try:
                     d.dump_monitor()
                     d.request("NOTE TEST-STOP " + name)
-                except Exception, e:
+                except Exception as e:
                     logger.info("Failed to issue TEST-STOP after {} for {}".format(name, d.ifname))
                     logger.info(e)
                     result = "FAIL"
@@ -556,7 +556,7 @@ def main():
                 rename_log(args.logdir, 'log5', name, wpas)
                 if not args.no_reset:
                     wpas.remove_ifname()
-            except Exception, e:
+            except Exception as e:
                 pass
             if wpas:
                 wpas.close_ctrl()
@@ -565,7 +565,7 @@ def main():
                 rename_log(args.logdir, 'log' + str(i), name, dev[i])
             try:
                 hapd = HostapdGlobal()
-            except Exception, e:
+            except Exception as e:
                 print "Failed to connect to hostapd interface"
                 print str(e)
                 reset_ok = False
index abed26fe5709651c88360c5c5b2915dc6f434d63..8e5b2d68b3b5703b62b6cc94ba5c04d6cdc000c4 100644 (file)
@@ -485,7 +485,7 @@ def get_rx_spec(phy, gtk=False):
                 continue
             with open(keydir + "/rx_spec") as f:
                 return f.read()
-    except OSError, e:
+    except OSError as e:
         raise HwsimSkip("debugfs not supported in mac80211")
     return None
 
@@ -501,7 +501,7 @@ def get_tk_replay_counter(phy, gtk=False):
                 continue
             with open(keydir + "/replays") as f:
                 return int(f.read())
-    except OSError, e:
+    except OSError as e:
         raise HwsimSkip("debugfs not supported in mac80211")
     return None
 
index 2fef021912cc0412e8ed17f77bf496541af7a914..9b6ba11a6a42ba7582370c6a2de4f62447141ff6 100644 (file)
@@ -206,7 +206,7 @@ def invalid_ap(ap):
     try:
         hapd.enable()
         started = True
-    except Exception, e:
+    except Exception as e:
         started = False
     if started:
         raise Exception("ENABLE command succeeded unexpectedly")
@@ -516,7 +516,7 @@ def test_ap_duplicate_bssid(dev, apdev):
     try:
         hostapd.add_bss(apdev[0], ifname2, 'bss-2-dup.conf')
         raise Exception("BSS add succeeded unexpectedly")
-    except Exception, e:
+    except Exception as e:
         if "Could not add hostapd BSS" in str(e):
             pass
         else:
index 0fa64e2352640ec142ace88d8c67b813c8b0bc4b..4d7fcb9b5abfee4b9355bf832db37bf211e91ad2 100644 (file)
@@ -2881,7 +2881,7 @@ def test_ap_wpa2_eap_eke_server_oom(dev, apdev):
                     if hapd.request("GET_ALLOC_FAIL").startswith('0'):
                         break
                 dev[0].request("REMOVE_NETWORK all")
-        except Exception, e:
+        except Exception as e:
             if str(e) == "Allocation failure did not trigger":
                 if count < 30:
                     raise Exception("Too few allocation failures")
@@ -3699,7 +3699,7 @@ def test_ap_wpa2_eap_fast_cipher_suites(dev, apdev):
                         ca_cert="auth_serv/ca.pem", phase2="auth=GTC",
                         pac_file="blob://fast_pac_ciphers",
                         report_failure=True)
-        except Exception, e:
+        except Exception as e:
             if cipher == "RC4-SHA" and \
                ("Could not select EAP method" in str(e) or \
                 "EAP failed" in str(e)):
index 6ab4f8ca23ef01693ffc825446dcf56659027bdf..2de21d49800525355d5ab72a26956c154c8b13a5 100644 (file)
@@ -446,7 +446,7 @@ def test_ap_ft_ocv(dev, apdev):
     params["ocv"] = "1"
     try:
         hapd0 = hostapd.add_ap(apdev[0], params)
-    except Exception, e:
+    except Exception as e:
         if "Failed to set hostapd parameter ocv" in str(e):
             raise HwsimSkip("OCV not supported")
         raise
@@ -582,7 +582,7 @@ def test_ap_ft_over_ds_ocv(dev, apdev):
     params["ocv"] = "1"
     try:
         hapd0 = hostapd.add_ap(apdev[0], params)
-    except Exception, e:
+    except Exception as e:
         if "Failed to set hostapd parameter ocv" in str(e):
             raise HwsimSkip("OCV not supported")
         raise
index 99a01a92da5213f886f6429970a061e810d57ce8..ec5ac026bcdaae3736be3b945ce07ae5c9fd58a2 100644 (file)
@@ -4853,7 +4853,7 @@ def _test_proxyarp_open(dev, apdev, params, ebtables=False):
 
     try:
         hwsim_utils.test_connectivity_iface(dev[0], hapd, "ap-br0")
-    except Exception, e:
+    except Exception as e:
         logger.info("test_connectibity_iface failed: " + str(e))
         raise HwsimSkip("Assume kernel did not have the required patches for proxyarp")
     hwsim_utils.test_connectivity_iface(dev[1], hapd, "ap-br0")
@@ -5110,7 +5110,7 @@ def _test_proxyarp_open_ipv6(dev, apdev, params, ebtables=False):
 
     try:
         hwsim_utils.test_connectivity_iface(dev[0], hapd, "ap-br0")
-    except Exception, e:
+    except Exception as e:
         logger.info("test_connectibity_iface failed: " + str(e))
         raise HwsimSkip("Assume kernel did not have the required patches for proxyarp")
     hwsim_utils.test_connectivity_iface(dev[1], hapd, "ap-br0")
index de7c6d4160e2f81b4010bceb76b263a34789a56f..3907925352ea110fff62e93213c44fc273bbbd96 100644 (file)
@@ -330,7 +330,7 @@ def _test_ap_open_wpas_in_bridge(dev, apdev):
     try:
         wpas.interface_add(ifname, br_ifname=br_ifname)
         raise Exception("Interface addition succeeded unexpectedly")
-    except Exception, e:
+    except Exception as e:
         if "Failed to add" in str(e):
             logger.info("Ignore expected interface_add failure due to missing bridge interface: " + str(e))
         else:
index a39bfcee2e2e70bd4b5414489f74f5f9de62b98f..16da15ae45e123ae421365878942b2d5e3244325 100644 (file)
@@ -666,7 +666,7 @@ def test_ap_missing_psk(dev, apdev):
         # "WPA-PSK enabled, but PSK or passphrase is not configured."
         hostapd.add_ap(apdev[0], params)
         raise Exception("AP setup succeeded unexpectedly")
-    except Exception, e:
+    except Exception as e:
         if "Failed to enable hostapd" in str(e):
             pass
         else:
index e2f6529b279d7be15113ab17cde83cdf99745b70..071f9e629d91b32a90822068bc238a3ff8dfe8da 100644 (file)
@@ -67,7 +67,7 @@ def test_ocv_sa_query(dev, apdev):
     params["ocv"] = "1"
     try:
         hapd = hostapd.add_ap(apdev[0], params)
-    except Exception, e:
+    except Exception as e:
         if "Failed to set hostapd parameter ocv" in str(e):
             raise HwsimSkip("OCV not supported")
         raise
@@ -104,7 +104,7 @@ def test_ocv_sa_query_csa(dev, apdev):
     params["ocv"] = "1"
     try:
         hapd = hostapd.add_ap(apdev[0], params)
-    except Exception, e:
+    except Exception as e:
         if "Failed to set hostapd parameter ocv" in str(e):
             raise HwsimSkip("OCV not supported")
         raise
@@ -194,7 +194,7 @@ def test_ap_pmf_negative(dev, apdev):
                        scan_freq="2412")
         hwsim_utils.test_connectivity(dev[1], hapd)
         raise Exception("PMF required STA connected to no PMF AP")
-    except Exception, e:
+    except Exception as e:
         logger.debug("Ignore expected exception: " + str(e))
     wt.require_ap_no_pmf(apdev[0]['bssid'])
 
index 2d1fc2cf5179ace9a06b5094b36db809590b2957..bba2bacf306d75a3ee3a797dc81adcb60576a8ba 100644 (file)
@@ -428,7 +428,7 @@ def test_ap_open_tdls_vht80(dev, apdev):
             res = cmd.stdout.read()
             cmd.stdout.close()
             logger.info("Station dump on dev[%d]:\n%s" % (i, res))
-    except Exception, e:
+    except Exception as e:
         if isinstance(e, Exception) and str(e) == "AP startup failed":
             if not vht_supported():
                 raise HwsimSkip("80/160 MHz channel not supported in regulatory information")
@@ -472,7 +472,7 @@ def test_ap_open_tdls_vht80plus80(dev, apdev):
             res = cmd.stdout.read()
             cmd.stdout.close()
             logger.info("Station dump on dev[%d]:\n%s" % (i, res))
-    except Exception, e:
+    except Exception as e:
         if isinstance(e, Exception) and str(e) == "AP startup failed":
             if not vht_supported():
                 raise HwsimSkip("80/160 MHz channel not supported in regulatory information")
@@ -516,7 +516,7 @@ def test_ap_open_tdls_vht160(dev, apdev):
             res = cmd.stdout.read()
             cmd.stdout.close()
             logger.info("Station dump on dev[%d]:\n%s" % (i, res))
-    except Exception, e:
+    except Exception as e:
         if isinstance(e, Exception) and str(e) == "AP startup failed":
             if not vht_supported():
                 raise HwsimSkip("80/160 MHz channel not supported in regulatory information")
index 1e15839764e45295e7f16a998e11400d7b8a6ee4..d1fc0e8307232726d4b0c8686f8b93fde1f5ffdf 100644 (file)
@@ -74,7 +74,7 @@ def test_ap_vht80(dev, apdev):
             raise Exception("Missing STA flag: HT")
         if "[VHT]" not in sta['flags']:
             raise Exception("Missing STA flag: VHT")
-    except Exception, e:
+    except Exception as e:
         if isinstance(e, Exception) and str(e) == "AP startup failed":
             if not vht_supported():
                 raise HwsimSkip("80 MHz channel not supported in regulatory information")
@@ -104,7 +104,7 @@ def vht80_test(apdev, dev, channel, ht_capab):
 
         dev.connect("vht", key_mgmt="NONE", scan_freq=str(5000 + 5 * channel))
         hwsim_utils.test_connectivity(dev, hapd)
-    except Exception, e:
+    except Exception as e:
         if isinstance(e, Exception) and str(e) == "AP startup failed":
             if not vht_supported():
                 raise HwsimSkip("80 MHz channel not supported in regulatory information")
@@ -165,7 +165,7 @@ def test_ap_vht80_params(dev, apdev):
             raise Exception("dev[0] did not support SGI")
         if capab2 & 0x60 != 0:
             raise Exception("dev[2] claimed support for SGI")
-    except Exception, e:
+    except Exception as e:
         if isinstance(e, Exception) and str(e) == "AP startup failed":
             if not vht_supported():
                 raise HwsimSkip("80 MHz channel not supported in regulatory information")
@@ -194,7 +194,7 @@ def test_ap_vht80_invalid(dev, apdev):
         ev = hapd.wait_event(["AP-DISABLED"], timeout=5)
         if ev is None:
             raise Exception("AP-DISABLED not reported")
-    except Exception, e:
+    except Exception as e:
         if isinstance(e, Exception) and str(e) == "AP startup failed":
             if not vht_supported():
                 raise HwsimSkip("80/160 MHz channel not supported in regulatory information")
@@ -225,7 +225,7 @@ def test_ap_vht80_invalid2(dev, apdev):
         ev = hapd.wait_event(["AP-DISABLED"], timeout=5)
         if ev is None:
             raise Exception("AP-DISABLED not reported")
-    except Exception, e:
+    except Exception as e:
         if isinstance(e, Exception) and str(e) == "AP startup failed":
             if not vht_supported():
                 raise HwsimSkip("80/160 MHz channel not supported in regulatory information")
@@ -371,7 +371,7 @@ def test_ap_vht160(dev, apdev):
             raise Exception("Unexpected SIGNAL_POLL value(1): " + str(sig))
         if "WIDTH=160 MHz" not in sig:
             raise Exception("Unexpected SIGNAL_POLL value(2): " + str(sig))
-    except Exception, e:
+    except Exception as e:
         if isinstance(e, Exception) and str(e) == "AP startup failed":
             if not vht_supported():
                 raise HwsimSkip("80/160 MHz channel not supported in regulatory information")
@@ -445,7 +445,7 @@ def test_ap_vht160b(dev, apdev):
             raise Exception("Unexpected SIGNAL_POLL value(1): " + str(sig))
         if "WIDTH=160 MHz" not in sig:
             raise Exception("Unexpected SIGNAL_POLL value(2): " + str(sig))
-    except Exception, e:
+    except Exception as e:
         if isinstance(e, Exception) and str(e) == "AP startup failed":
             if not vht_supported():
                 raise HwsimSkip("80/160 MHz channel not supported in regulatory information")
@@ -525,7 +525,7 @@ def run_ap_vht160_no_dfs(dev, apdev, channel, ht_capab):
             raise Exception("Unexpected SIGNAL_POLL value(1): " + str(sig))
         if "WIDTH=160 MHz" not in sig:
             raise Exception("Unexpected SIGNAL_POLL value(2): " + str(sig))
-    except Exception, e:
+    except Exception as e:
         if isinstance(e, Exception) and str(e) == "AP startup failed":
             if not vht_supported():
                 raise HwsimSkip("80/160 MHz channel not supported in regulatory information")
@@ -567,7 +567,7 @@ def test_ap_vht160_no_ht40(dev, apdev):
         if "AP-ENABLED" in ev:
             # This was supposed to fail due to sec_channel_offset == 0
             raise Exception("Unexpected AP-ENABLED")
-    except Exception, e:
+    except Exception as e:
         if isinstance(e, Exception) and str(e) == "AP startup failed":
             if not vht_supported():
                 raise HwsimSkip("80/160 MHz channel not supported in regulatory information")
@@ -634,7 +634,7 @@ def test_ap_vht80plus80(dev, apdev):
             raise Exception("Unexpected SIGNAL_POLL value(3): " + str(sig))
         if "CENTER_FRQ2=5775" not in sig:
             raise Exception("Unexpected SIGNAL_POLL value(4): " + str(sig))
-    except Exception, e:
+    except Exception as e:
         if isinstance(e, Exception) and str(e) == "AP startup failed":
             if not vht_supported():
                 raise HwsimSkip("80/160 MHz channel not supported in regulatory information")
@@ -671,7 +671,7 @@ def test_ap_vht80plus80_invalid(dev, apdev):
         ev = hapd.wait_event(["AP-DISABLED"], timeout=5)
         if ev is None:
             raise Exception("AP-DISABLED not reported")
-    except Exception, e:
+    except Exception as e:
         if isinstance(e, Exception) and str(e) == "AP startup failed":
             if not vht_supported():
                 raise HwsimSkip("80/160 MHz channel not supported in regulatory information")
@@ -723,7 +723,7 @@ def test_ap_vht80_csa(dev, apdev):
         # extra code coverage.
         hapd.request("CHAN_SWITCH 5 5745")
         hapd.wait_event(["AP-CSA-FINISHED"], timeout=1)
-    except Exception, e:
+    except Exception as e:
         if isinstance(e, Exception) and str(e) == "AP startup failed":
             if not vht_supported():
                 raise HwsimSkip("80 MHz channel not supported in regulatory information")
@@ -969,7 +969,7 @@ def test_ap_vht80_pwr_constraint(dev, apdev):
 
         dev[0].connect("vht", key_mgmt="NONE", scan_freq="5180")
         dev[0].wait_regdom(country_ie=True)
-    except Exception, e:
+    except Exception as e:
         if isinstance(e, Exception) and str(e) == "AP startup failed":
             if not vht_supported():
                 raise HwsimSkip("80 MHz channel not supported in regulatory information")
@@ -1003,7 +1003,7 @@ def test_ap_vht_use_sta_nsts(dev, apdev):
 
         dev[0].connect("vht", key_mgmt="NONE", scan_freq="5180")
         hwsim_utils.test_connectivity(dev[0], hapd)
-    except Exception, e:
+    except Exception as e:
         if isinstance(e, Exception) and str(e) == "AP startup failed":
             if not vht_supported():
                 raise HwsimSkip("80 MHz channel not supported in regulatory information")
@@ -1050,7 +1050,7 @@ def test_ap_vht_tkip(dev, apdev):
             raise Exception("Unexpected STATUS ieee80211ac value")
         if status["secondary_channel"] != "0":
             raise Exception("Unexpected STATUS secondary_channel value")
-    except Exception, e:
+    except Exception as e:
         if isinstance(e, Exception) and str(e) == "AP startup failed":
             if not vht_supported():
                 raise HwsimSkip("80 MHz channel not supported in regulatory information")
@@ -1122,7 +1122,7 @@ def test_ap_vht80_to_24g_ht(dev, apdev):
         hapd.enable()
 
         dev[0].connect("vht", key_mgmt="NONE", scan_freq="2412")
-    except Exception, e:
+    except Exception as e:
         if isinstance(e, Exception) and str(e) == "AP startup failed":
             if not vht_supported():
                 raise HwsimSkip("80 MHz channel not supported in regulatory information")
index 62e1d32b1872112f0de4b9ca353d9c547d4e7f18..bde4338a31a232af410263cb4b6ad445233de057 100644 (file)
@@ -294,7 +294,7 @@ def generic_ap_vlan_wpa2_radius_id_change(dev, apdev, tagged):
                                               ifname2="brvlan1")
         else:
             hwsim_utils.test_connectivity_iface(dev[0], hapd, "brvlan1")
-    except Exception, e:
+    except Exception as e:
         # It is possible for new bridge setup to not be ready immediately, so
         # try again to avoid reporting issues related to that.
         logger.info("First VLAN-ID 1 data test failed - try again")
index b8fcfb320c6c4fb786654a77da2cacd4e9df7774..ad72faf7f777f5e59cae02e30853694c6d343581 100644 (file)
@@ -2329,7 +2329,7 @@ def test_ap_wps_auto_setup_with_config_file(dev, apdev):
                 try:
                     [name,value] = l.split('=', 1)
                     vals[name] = value
-                except ValueError, e:
+                except ValueError as e:
                     if "# WPS configuration" in l:
                         pass
                     else:
@@ -3322,7 +3322,7 @@ def test_ap_wps_upnp_http_proto(dev, apdev):
         try:
             conn.request(cmd, "hello")
             resp = conn.getresponse()
-        except Exception, e:
+        except Exception as e:
             pass
         conn.close()
 
@@ -3330,7 +3330,7 @@ def test_ap_wps_upnp_http_proto(dev, apdev):
     conn.request("HEAD", "hello", "\r\n\r\n", headers)
     try:
         resp = conn.getresponse()
-    except Exception, e:
+    except Exception as e:
         pass
     conn.close()
 
@@ -3338,7 +3338,7 @@ def test_ap_wps_upnp_http_proto(dev, apdev):
     conn.request("HEAD", "hello", "\r\n\r\n", headers)
     try:
         resp = conn.getresponse()
-    except Exception, e:
+    except Exception as e:
         pass
     conn.close()
 
@@ -3346,7 +3346,7 @@ def test_ap_wps_upnp_http_proto(dev, apdev):
     conn.request("HEAD", "hello", "\r\n\r\nhello", headers)
     try:
         resp = conn.getresponse()
-    except Exception, e:
+    except Exception as e:
         pass
     conn.close()
 
@@ -3368,7 +3368,7 @@ def test_ap_wps_upnp_http_proto(dev, apdev):
     conn.request("HEAD", 5000 * 'A')
     try:
         resp = conn.getresponse()
-    except Exception, e:
+    except Exception as e:
         pass
     conn.close()
 
@@ -3383,7 +3383,7 @@ def test_ap_wps_upnp_http_proto(dev, apdev):
     conn.request("POST", "hello", 10 * 'A' + "\r\n\r\n", headers)
     try:
         resp = conn.getresponse()
-    except Exception, e:
+    except Exception as e:
         pass
     conn.close()
 
@@ -3396,7 +3396,7 @@ def test_ap_wps_upnp_http_proto(dev, apdev):
     conn.request("POST", "hello", 60000 * 'A' + "\r\n\r\n")
     try:
         resp = conn.getresponse()
-    except Exception, e:
+    except Exception as e:
         pass
     conn.close()
 
@@ -3442,7 +3442,7 @@ def test_ap_wps_upnp_http_proto_chunked(dev, apdev):
         conn.send("0\r\n\r\n")
         resp = conn.getresponse()
         completed = True
-    except Exception, e:
+    except Exception as e:
         pass
     conn.close()
     if completed:
@@ -3452,14 +3452,14 @@ def test_ap_wps_upnp_http_proto_chunked(dev, apdev):
     conn.request("POST", "hello", "80000000\r\na", headers)
     try:
         resp = conn.getresponse()
-    except Exception, e:
+    except Exception as e:
         pass
     conn.close()
 
     conn.request("POST", "hello", "10000000\r\na", headers)
     try:
         resp = conn.getresponse()
-    except Exception, e:
+    except Exception as e:
         pass
     conn.close()
 
@@ -4203,7 +4203,7 @@ def send_wlanevent(url, uuid, data, no_response=False):
     if no_response:
         try:
             conn.getresponse()
-        except Exception, e:
+        except Exception as e:
             pass
         return
     resp = conn.getresponse()
@@ -5127,7 +5127,7 @@ def wps_run_pbc_fail_ap(apdev, dev, hapd):
         try:
             dev.flush_scan_cache()
             break
-        except Exception, e:
+        except Exception as e:
             if str(e).startswith("Failed to trigger scan"):
                 # Try again
                 time.sleep(1)
index 3baca4c54a94178d313d07a04b152d2906d00f57..e0703fae00380cfa30f88f70c2b85aaa1cad2b67 100644 (file)
@@ -51,7 +51,7 @@ def prepare_dbus(dev):
         path = wpas.GetInterface(dev.ifname)
         if_obj = bus.get_object(WPAS_DBUS_SERVICE, path)
         return (bus,wpas_obj,path,if_obj)
-    except Exception, e:
+    except Exception as e:
         raise HwsimSkip("Could not connect to D-Bus: %s" % e)
 
 class TestDbus(object):
@@ -182,7 +182,7 @@ def test_dbus_getall_oom(dev, apdev):
             try:
                 props = net_obj.GetAll(WPAS_DBUS_NETWORK,
                                        dbus_interface=dbus.PROPERTIES_IFACE)
-            except dbus.exceptions.DBusException, e:
+            except dbus.exceptions.DBusException as e:
                 pass
 
 def dbus_get(dbus, wpas_obj, prop, expect=None, byte_arrays=False):
@@ -210,7 +210,7 @@ def test_dbus_properties(dev, apdev):
         try:
             dbus_set(dbus, wpas_obj, "DebugLevel", val)
             raise Exception("Invalid DebugLevel value accepted: " + str(val))
-        except dbus.exceptions.DBusException, e:
+        except dbus.exceptions.DBusException as e:
             if err not in str(e):
                 raise Exception("Unexpected error message: " + str(e))
     dbus_set(dbus, wpas_obj, "DebugLevel", "msgdump")
@@ -222,7 +222,7 @@ def test_dbus_properties(dev, apdev):
     try:
         dbus_set(dbus, wpas_obj, "DebugTimestamp", "foo")
         raise Exception("Invalid DebugTimestamp value accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "Error.Failed: wrong property type" not in str(e):
             raise Exception("Unexpected error message: " + str(e))
     dbus_set(dbus, wpas_obj, "DebugTimestamp", True)
@@ -234,7 +234,7 @@ def test_dbus_properties(dev, apdev):
     try:
         dbus_set(dbus, wpas_obj, "DebugShowKeys", "foo")
         raise Exception("Invalid DebugShowKeys value accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "Error.Failed: wrong property type" not in str(e):
             raise Exception("Unexpected error message: " + str(e))
     dbus_set(dbus, wpas_obj, "DebugShowKeys", True)
@@ -261,7 +261,7 @@ def test_dbus_properties(dev, apdev):
     try:
         dbus_set(dbus, wpas_obj, "WFDIEs", dbus.ByteArray('\x00'))
         raise Exception("Invalid WFDIEs value accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "InvalidArgs" not in str(e):
             raise Exception("Unexpected error message: " + str(e))
     dbus_set(dbus, wpas_obj, "WFDIEs", dbus.ByteArray(''))
@@ -275,7 +275,7 @@ def test_dbus_properties(dev, apdev):
     try:
         dbus_set(dbus, wpas_obj, "EapMethods", res)
         raise Exception("Invalid Set accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "InvalidArgs: Property is read-only" not in str(e):
             raise Exception("Unexpected error message: " + str(e))
 
@@ -283,7 +283,7 @@ def test_dbus_properties(dev, apdev):
         wpas_obj.SetFoo(WPAS_DBUS_SERVICE, "DebugShowKeys", True,
                         dbus_interface=dbus.PROPERTIES_IFACE)
         raise Exception("Unknown method accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "UnknownMethod" not in str(e):
             raise Exception("Unexpected error message: " + str(e))
 
@@ -291,7 +291,7 @@ def test_dbus_properties(dev, apdev):
         wpas_obj.Get("foo", "DebugShowKeys",
                      dbus_interface=dbus.PROPERTIES_IFACE)
         raise Exception("Invalid Get accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "InvalidArgs: No such property" not in str(e):
             raise Exception("Unexpected error message: " + str(e))
 
@@ -301,14 +301,14 @@ def test_dbus_properties(dev, apdev):
         test_obj.Get(123, "DebugShowKeys",
                      dbus_interface=dbus.PROPERTIES_IFACE)
         raise Exception("Invalid Get accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "InvalidArgs: Invalid arguments" not in str(e):
             raise Exception("Unexpected error message: " + str(e))
     try:
         test_obj.Get(WPAS_DBUS_SERVICE, 123,
                      dbus_interface=dbus.PROPERTIES_IFACE)
         raise Exception("Invalid Get accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "InvalidArgs: Invalid arguments" not in str(e):
             raise Exception("Unexpected error message: " + str(e))
 
@@ -317,7 +317,7 @@ def test_dbus_properties(dev, apdev):
                      dbus.ByteArray('', variant_level=2),
                      dbus_interface=dbus.PROPERTIES_IFACE)
         raise Exception("Invalid Set accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "InvalidArgs: invalid message format" not in str(e):
             raise Exception("Unexpected error message: " + str(e))
 
@@ -351,7 +351,7 @@ def test_dbus_invalid_method(dev, apdev):
     try:
         wps.Foo()
         raise Exception("Unknown method accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "UnknownMethod" not in str(e):
             raise Exception("Unexpected error message: " + str(e))
 
@@ -360,7 +360,7 @@ def test_dbus_invalid_method(dev, apdev):
     try:
         test_wps.Start(123)
         raise Exception("WPS.Start with incorrect signature accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "InvalidArgs: Invalid arg" not in str(e):
             raise Exception("Unexpected error message: " + str(e))
 
@@ -537,7 +537,7 @@ def test_dbus_wps_invalid(dev, apdev):
         try:
             wps.Start(args)
             raise Exception("Invalid WPS.Start() arguments accepted: " + str(args))
-        except dbus.exceptions.DBusException, e:
+        except dbus.exceptions.DBusException as e:
             if not str(e).startswith("fi.w1.wpa_supplicant1.InvalidArgs"):
                 raise Exception("Unexpected error message: " + str(e))
 
@@ -571,7 +571,7 @@ def test_dbus_wps_oom(dev, apdev):
         try:
             bss_obj.Get(WPAS_DBUS_BSS, "Rates",
                         dbus_interface=dbus.PROPERTIES_IFACE)
-        except dbus.exceptions.DBusException, e:
+        except dbus.exceptions.DBusException as e:
             pass
 
     id = dev[0].add_network()
@@ -1031,7 +1031,7 @@ def test_dbus_scan_invalid(dev, apdev):
         try:
             iface.Scan(t)
             raise Exception("Invalid Scan() arguments accepted: " + str(t))
-        except dbus.exceptions.DBusException, e:
+        except dbus.exceptions.DBusException as e:
             if err not in str(e):
                 raise Exception("Unexpected error message for invalid Scan(%s): %s" % (str(t), str(e)))
 
@@ -1162,7 +1162,7 @@ def test_dbus_scan_busy(dev, apdev):
     try:
         iface.Scan({'Type': 'active', 'AllowRoam': False})
         raise Exception("Scan() accepted when busy")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "ScanError: Scan request reject" not in str(e):
             raise Exception("Unexpected error message: " + str(e))
 
@@ -1436,13 +1436,13 @@ def test_dbus_connect_oom(dev, apdev):
                                    signature='sv')
             try:
                 self.netw = iface.AddNetwork(args)
-            except Exception, e:
+            except Exception as e:
                 logger.info("Exception on AddNetwork: " + str(e))
                 self.loop.quit()
                 return False
             try:
                 iface.SelectNetwork(self.netw)
-            except Exception, e:
+            except Exception as e:
                 logger.info("Exception on SelectNetwork: " + str(e))
                 self.loop.quit()
 
@@ -1499,14 +1499,14 @@ def test_dbus_while_not_connected(dev, apdev):
     try:
         iface.Disconnect()
         raise Exception("Disconnect() accepted when not connected")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "NotConnected" not in str(e):
             raise Exception("Unexpected error message for invalid Disconnect: " + str(e))
 
     try:
         iface.Reattach()
         raise Exception("Reattach() accepted when not connected")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "NotConnected" not in str(e):
             raise Exception("Unexpected error message for invalid Reattach: " + str(e))
 
@@ -1661,13 +1661,13 @@ def test_dbus_network(dev, apdev):
     try:
         iface.RemoveNetwork(netw)
         raise Exception("Invalid RemoveNetwork() accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "NetworkUnknown" not in str(e):
             raise Exception("Unexpected error message for invalid RemoveNetwork: " + str(e))
     try:
         iface.SelectNetwork(netw)
         raise Exception("Invalid SelectNetwork() accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "NetworkUnknown" not in str(e):
             raise Exception("Unexpected error message for invalid RemoveNetwork: " + str(e))
 
@@ -1704,7 +1704,7 @@ def test_dbus_network(dev, apdev):
         net_obj.Set(WPAS_DBUS_NETWORK, "Enabled", dbus.UInt32(1),
                     dbus_interface=dbus.PROPERTIES_IFACE)
         raise Exception("Invalid Set(Enabled,1) accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "Error.Failed: wrong property type" not in str(e):
             raise Exception("Unexpected error message for invalid Set(Enabled,1): " + str(e))
 
@@ -1734,7 +1734,7 @@ def test_dbus_network(dev, apdev):
         try:
             iface.AddNetwork(args)
             raise Exception("Invalid AddNetwork args accepted: " + str(args))
-        except dbus.exceptions.DBusException, e:
+        except dbus.exceptions.DBusException as e:
             if "InvalidArgs" not in str(e):
                 raise Exception("Unexpected error message for invalid AddNetwork: " + str(e))
 
@@ -1770,7 +1770,7 @@ def test_dbus_network_oom(dev, apdev):
             # Currently, AddNetwork() succeeds even if os_strdup() for path
             # fails, so remove the network if that occurs.
             iface.RemoveNetwork(netw)
-        except dbus.exceptions.DBusException, e:
+        except dbus.exceptions.DBusException as e:
             pass
 
     for i in range(1, 3):
@@ -1780,7 +1780,7 @@ def test_dbus_network_oom(dev, apdev):
                 # Currently, AddNetwork() succeeds even if network registration
                 # fails, so remove the network if that occurs.
                 iface.RemoveNetwork(netw)
-            except dbus.exceptions.DBusException, e:
+            except dbus.exceptions.DBusException as e:
                 pass
 
     with alloc_fail_dbus(dev[0], 1,
@@ -1857,7 +1857,7 @@ def _test_dbus_interface(dev, apdev):
     try:
         wpas.CreateInterface(params)
         raise Exception("Invalid CreateInterface() accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "InterfaceExists" not in str(e):
             raise Exception("Unexpected error message for invalid CreateInterface: " + str(e))
 
@@ -1865,7 +1865,7 @@ def _test_dbus_interface(dev, apdev):
     try:
         wpas.RemoveInterface(path)
         raise Exception("Invalid RemoveInterface() accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "InterfaceUnknown" not in str(e):
             raise Exception("Unexpected error message for invalid RemoveInterface: " + str(e))
 
@@ -1875,7 +1875,7 @@ def _test_dbus_interface(dev, apdev):
     try:
         wpas.CreateInterface(params)
         raise Exception("Invalid CreateInterface() accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "InvalidArgs" not in str(e):
             raise Exception("Unexpected error message for invalid CreateInterface: " + str(e))
 
@@ -1883,14 +1883,14 @@ def _test_dbus_interface(dev, apdev):
     try:
         wpas.CreateInterface(params)
         raise Exception("Invalid CreateInterface() accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "InvalidArgs" not in str(e):
             raise Exception("Unexpected error message for invalid CreateInterface: " + str(e))
 
     try:
         wpas.GetInterface("lo")
         raise Exception("Invalid GetInterface() accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "InterfaceUnknown" not in str(e):
             raise Exception("Unexpected error message for invalid RemoveInterface: " + str(e))
 
@@ -1920,7 +1920,7 @@ def test_dbus_interface_oom(dev, apdev):
                 raise Exception("CreateInterface succeeded during out-of-memory")
             if not state.startswith('0:'):
                 break
-        except dbus.exceptions.DBusException, e:
+        except dbus.exceptions.DBusException as e:
             pass
 
     for arg in [ 'Driver', 'Ifname', 'ConfigFile', 'BridgeIfname' ]:
@@ -1939,7 +1939,7 @@ def test_dbus_blob(dev, apdev):
     try:
         iface.AddBlob('blob1', dbus.ByteArray("\x01\x02\x04"))
         raise Exception("Invalid AddBlob() accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "BlobExists" not in str(e):
             raise Exception("Unexpected error message for invalid AddBlob: " + str(e))
     res = iface.GetBlob('blob1')
@@ -1956,13 +1956,13 @@ def test_dbus_blob(dev, apdev):
     try:
         iface.RemoveBlob('blob1')
         raise Exception("Invalid RemoveBlob() accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "BlobUnknown" not in str(e):
             raise Exception("Unexpected error message for invalid RemoveBlob: " + str(e))
     try:
         iface.GetBlob('blob1')
         raise Exception("Invalid GetBlob() accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "BlobUnknown" not in str(e):
             raise Exception("Unexpected error message for invalid GetBlob: " + str(e))
 
@@ -2045,14 +2045,14 @@ def test_dbus_tdls_invalid(dev, apdev):
     try:
         iface.TDLSDiscover("foo")
         raise Exception("Invalid TDLSDiscover() accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "InvalidArgs" not in str(e):
             raise Exception("Unexpected error message for invalid TDLSDiscover: " + str(e))
 
     try:
         iface.TDLSStatus("foo")
         raise Exception("Invalid TDLSStatus() accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "InvalidArgs" not in str(e):
             raise Exception("Unexpected error message for invalid TDLSStatus: " + str(e))
 
@@ -2063,35 +2063,35 @@ def test_dbus_tdls_invalid(dev, apdev):
     try:
         iface.TDLSSetup("foo")
         raise Exception("Invalid TDLSSetup() accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "InvalidArgs" not in str(e):
             raise Exception("Unexpected error message for invalid TDLSSetup: " + str(e))
 
     try:
         iface.TDLSTeardown("foo")
         raise Exception("Invalid TDLSTeardown() accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "InvalidArgs" not in str(e):
             raise Exception("Unexpected error message for invalid TDLSTeardown: " + str(e))
 
     try:
         iface.TDLSTeardown("00:11:22:33:44:55")
         raise Exception("TDLSTeardown accepted for unknown peer")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "UnknownError: error performing TDLS teardown" not in str(e):
             raise Exception("Unexpected error message: " + str(e))
 
     try:
         iface.TDLSChannelSwitch({})
         raise Exception("Invalid TDLSChannelSwitch() accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "InvalidArgs" not in str(e):
             raise Exception("Unexpected error message for invalid TDLSChannelSwitch: " + str(e))
 
     try:
         iface.TDLSCancelChannelSwitch("foo")
         raise Exception("Invalid TDLSCancelChannelSwitch() accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "InvalidArgs" not in str(e):
             raise Exception("Unexpected error message for invalid TDLSCancelChannelSwitch: " + str(e))
 
@@ -2227,7 +2227,7 @@ def test_dbus_tdls_channel_switch(dev, apdev):
                                    signature='sv')
             try:
                 iface.TDLSChannelSwitch(args)
-            except Exception, e:
+            except Exception as e:
                 if "InvalidArgs" not in str(e):
                     raise Exception("Unexpected exception")
 
@@ -2235,7 +2235,7 @@ def test_dbus_tdls_channel_switch(dev, apdev):
             args = dbus.Dictionary({}, signature='sv')
             try:
                 iface.TDLSChannelSwitch(args)
-            except Exception, e:
+            except Exception as e:
                 if "InvalidArgs" not in str(e):
                     raise Exception("Unexpected exception")
 
@@ -2244,7 +2244,7 @@ def test_dbus_tdls_channel_switch(dev, apdev):
                                    signature='sv')
             try:
                 iface.TDLSChannelSwitch(args)
-            except Exception, e:
+            except Exception as e:
                 if "InvalidArgs" not in str(e):
                     raise Exception("Unexpected exception")
 
@@ -2254,7 +2254,7 @@ def test_dbus_tdls_channel_switch(dev, apdev):
                                    signature='sv')
             try:
                 iface.TDLSChannelSwitch(args)
-            except Exception, e:
+            except Exception as e:
                 if "InvalidArgs" not in str(e):
                     raise Exception("Unexpected exception")
 
@@ -2295,13 +2295,13 @@ def test_dbus_pkcs11(dev, apdev):
 
     try:
         iface.SetPKCS11EngineAndModulePath("foo", "bar")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "Error.Failed: Reinit of the EAPOL" not in str(e):
             raise Exception("Unexpected error message for invalid SetPKCS11EngineAndModulePath: " + str(e))
 
     try:
         iface.SetPKCS11EngineAndModulePath("foo", "")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "Error.Failed: Reinit of the EAPOL" not in str(e):
             raise Exception("Unexpected error message for invalid SetPKCS11EngineAndModulePath: " + str(e))
 
@@ -2352,7 +2352,7 @@ def _test_dbus_apscan(dev, apdev):
         if_obj.Set(WPAS_DBUS_IFACE, "ApScan", dbus.Int16(-1),
                    dbus_interface=dbus.PROPERTIES_IFACE)
         raise Exception("Invalid Set(ApScan,-1) accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "Error.Failed: wrong property type" not in str(e):
             raise Exception("Unexpected error message for invalid Set(ApScan,-1): " + str(e))
 
@@ -2360,7 +2360,7 @@ def _test_dbus_apscan(dev, apdev):
         if_obj.Set(WPAS_DBUS_IFACE, "ApScan", dbus.UInt32(123),
                    dbus_interface=dbus.PROPERTIES_IFACE)
         raise Exception("Invalid Set(ApScan,123) accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "Error.Failed: ap_scan must be 0, 1, or 2" not in str(e):
             raise Exception("Unexpected error message for invalid Set(ApScan,123): " + str(e))
 
@@ -2415,7 +2415,7 @@ def test_dbus_fastreauth(dev, apdev):
         if_obj.Set(WPAS_DBUS_IFACE, "FastReauth", dbus.Int16(-1),
                    dbus_interface=dbus.PROPERTIES_IFACE)
         raise Exception("Invalid Set(FastReauth,-1) accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "Error.Failed: wrong property type" not in str(e):
             raise Exception("Unexpected error message for invalid Set(ApScan,-1): " + str(e))
 
@@ -2444,7 +2444,7 @@ def test_dbus_bss_expire(dev, apdev):
         if_obj.Set(WPAS_DBUS_IFACE, "BSSExpireAge", dbus.Int16(-1),
                    dbus_interface=dbus.PROPERTIES_IFACE)
         raise Exception("Invalid Set(BSSExpireAge,-1) accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "Error.Failed: wrong property type" not in str(e):
             raise Exception("Unexpected error message for invalid Set(BSSExpireAge,-1): " + str(e))
 
@@ -2452,7 +2452,7 @@ def test_dbus_bss_expire(dev, apdev):
         if_obj.Set(WPAS_DBUS_IFACE, "BSSExpireAge", dbus.UInt32(9),
                    dbus_interface=dbus.PROPERTIES_IFACE)
         raise Exception("Invalid Set(BSSExpireAge,9) accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "Error.Failed: BSSExpireAge must be >= 10" not in str(e):
             raise Exception("Unexpected error message for invalid Set(BSSExpireAge,9): " + str(e))
 
@@ -2460,7 +2460,7 @@ def test_dbus_bss_expire(dev, apdev):
         if_obj.Set(WPAS_DBUS_IFACE, "BSSExpireCount", dbus.Int16(-1),
                    dbus_interface=dbus.PROPERTIES_IFACE)
         raise Exception("Invalid Set(BSSExpireCount,-1) accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "Error.Failed: wrong property type" not in str(e):
             raise Exception("Unexpected error message for invalid Set(BSSExpireCount,-1): " + str(e))
 
@@ -2468,7 +2468,7 @@ def test_dbus_bss_expire(dev, apdev):
         if_obj.Set(WPAS_DBUS_IFACE, "BSSExpireCount", dbus.UInt32(0),
                    dbus_interface=dbus.PROPERTIES_IFACE)
         raise Exception("Invalid Set(BSSExpireCount,0) accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "Error.Failed: BSSExpireCount must be > 0" not in str(e):
             raise Exception("Unexpected error message for invalid Set(BSSExpireCount,0): " + str(e))
 
@@ -2513,7 +2513,7 @@ def _test_dbus_country(dev, apdev):
         if_obj.Set(WPAS_DBUS_IFACE, "Country", dbus.Int16(-1),
                    dbus_interface=dbus.PROPERTIES_IFACE)
         raise Exception("Invalid Set(Country,-1) accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "Error.Failed: wrong property type" not in str(e):
             raise Exception("Unexpected error message for invalid Set(Country,-1): " + str(e))
 
@@ -2521,7 +2521,7 @@ def _test_dbus_country(dev, apdev):
         if_obj.Set(WPAS_DBUS_IFACE, "Country", "F",
                    dbus_interface=dbus.PROPERTIES_IFACE)
         raise Exception("Invalid Set(Country,F) accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "Error.Failed: invalid country code" not in str(e):
             raise Exception("Unexpected error message for invalid Set(Country,F): " + str(e))
 
@@ -2560,7 +2560,7 @@ def _test_dbus_scan_interval(dev, apdev):
         if_obj.Set(WPAS_DBUS_IFACE, "ScanInterval", dbus.UInt16(100),
                    dbus_interface=dbus.PROPERTIES_IFACE)
         raise Exception("Invalid Set(ScanInterval,100) accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "Error.Failed: wrong property type" not in str(e):
             raise Exception("Unexpected error message for invalid Set(ScanInterval,100): " + str(e))
 
@@ -2568,7 +2568,7 @@ def _test_dbus_scan_interval(dev, apdev):
         if_obj.Set(WPAS_DBUS_IFACE, "ScanInterval", dbus.Int32(-1),
                    dbus_interface=dbus.PROPERTIES_IFACE)
         raise Exception("Invalid Set(ScanInterval,-1) accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "Error.Failed: scan_interval must be >= 0" not in str(e):
             raise Exception("Unexpected error message for invalid Set(ScanInterval,-1): " + str(e))
 
@@ -2626,7 +2626,7 @@ def test_dbus_probe_req_reporting(dev, apdev):
         try:
             t.iface.UnsubscribeProbeReq()
             raise Exception("Invalid UnsubscribeProbeReq() accepted")
-        except dbus.exceptions.DBusException, e:
+        except dbus.exceptions.DBusException as e:
             if "NoSubscription" not in str(e):
                 raise Exception("Unexpected error message for invalid UnsubscribeProbeReq(): " + str(e))
         t.group_p2p.Disconnect()
@@ -2650,7 +2650,7 @@ def test_dbus_probe_req_reporting_oom(dev, apdev):
     try:
         iface.UnsubscribeProbeReq()
         was_subscribed = True
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         was_subscribed = False
         pass
 
@@ -2671,14 +2671,14 @@ def test_dbus_p2p_invalid(dev, apdev):
     try:
         p2p.RejectPeer(path + "/Peers/00112233445566")
         raise Exception("Invalid RejectPeer accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "UnknownError: Failed to call wpas_p2p_reject" not in str(e):
             raise Exception("Unexpected error message for invalid RejectPeer(): " + str(e))
 
     try:
         p2p.RejectPeer("/foo")
         raise Exception("Invalid RejectPeer accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "InvalidArgs" not in str(e):
             raise Exception("Unexpected error message for invalid RejectPeer(): " + str(e))
 
@@ -2691,7 +2691,7 @@ def test_dbus_p2p_invalid(dev, apdev):
         try:
             p2p.RemoveClient(t)
             raise Exception("Invalid RemoveClient accepted")
-        except dbus.exceptions.DBusException, e:
+        except dbus.exceptions.DBusException as e:
             if "InvalidArgs" not in str(e):
                 raise Exception("Unexpected error message for invalid RemoveClient(): " + str(e))
 
@@ -2717,7 +2717,7 @@ def test_dbus_p2p_invalid(dev, apdev):
         try:
             p2p.Find(dbus.Dictionary(t))
             raise Exception("Invalid Find accepted")
-        except dbus.exceptions.DBusException, e:
+        except dbus.exceptions.DBusException as e:
             if "InvalidArgs" not in str(e):
                 raise Exception("Unexpected error message for invalid Find(): " + str(e))
 
@@ -2727,7 +2727,7 @@ def test_dbus_p2p_invalid(dev, apdev):
         try:
             p2p.RemovePersistentGroup(dbus.ObjectPath(p))
             raise Exception("Invalid RemovePersistentGroup accepted")
-        except dbus.exceptions.DBusException, e:
+        except dbus.exceptions.DBusException as e:
             if "InvalidArgs" not in str(e):
                 raise Exception("Unexpected error message for invalid RemovePersistentGroup: " + str(e))
 
@@ -2735,7 +2735,7 @@ def test_dbus_p2p_invalid(dev, apdev):
         dev[0].request("P2P_SET disabled 1")
         p2p.Listen(5)
         raise Exception("Invalid Listen accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "UnknownError: Could not start P2P listen" not in str(e):
             raise Exception("Unexpected error message for invalid Listen: " + str(e))
     finally:
@@ -2746,7 +2746,7 @@ def test_dbus_p2p_invalid(dev, apdev):
     try:
         test_p2p.Listen("foo")
         raise Exception("Invalid Listen accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "InvalidArgs" not in str(e):
             raise Exception("Unexpected error message for invalid Listen: " + str(e))
 
@@ -2754,7 +2754,7 @@ def test_dbus_p2p_invalid(dev, apdev):
         dev[0].request("P2P_SET disabled 1")
         p2p.ExtendedListen(dbus.Dictionary({}))
         raise Exception("Invalid ExtendedListen accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "UnknownError: failed to initiate a p2p_ext_listen" not in str(e):
             raise Exception("Unexpected error message for invalid ExtendedListen: " + str(e))
     finally:
@@ -2766,7 +2766,7 @@ def test_dbus_p2p_invalid(dev, apdev):
                  'duration2': 20000, 'interval2': 102400 }
         p2p.PresenceRequest(args)
         raise Exception("Invalid PresenceRequest accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "UnknownError: Failed to invoke presence request" not in str(e):
             raise Exception("Unexpected error message for invalid PresenceRequest: " + str(e))
     finally:
@@ -2776,7 +2776,7 @@ def test_dbus_p2p_invalid(dev, apdev):
         params = dbus.Dictionary({'frequency': dbus.Int32(-1)})
         p2p.GroupAdd(params)
         raise Exception("Invalid GroupAdd accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "InvalidArgs" not in str(e):
             raise Exception("Unexpected error message for invalid GroupAdd: " + str(e))
 
@@ -2786,14 +2786,14 @@ def test_dbus_p2p_invalid(dev, apdev):
                                   'frequency': 2412})
         p2p.GroupAdd(params)
         raise Exception("Invalid GroupAdd accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "InvalidArgs" not in str(e):
             raise Exception("Unexpected error message for invalid GroupAdd: " + str(e))
 
     try:
         p2p.Disconnect()
         raise Exception("Invalid Disconnect accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "UnknownError: failed to disconnect" not in str(e):
             raise Exception("Unexpected error message for invalid Disconnect: " + str(e))
 
@@ -2801,7 +2801,7 @@ def test_dbus_p2p_invalid(dev, apdev):
         dev[0].request("P2P_SET disabled 1")
         p2p.Flush()
         raise Exception("Invalid Flush accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "Error.Failed: P2P is not available for this interface" not in str(e):
             raise Exception("Unexpected error message for invalid Flush: " + str(e))
     finally:
@@ -2815,7 +2815,7 @@ def test_dbus_p2p_invalid(dev, apdev):
                  'frequency': 2412 }
         pin = p2p.Connect(args)
         raise Exception("Invalid Connect accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "Error.Failed: P2P is not available for this interface" not in str(e):
             raise Exception("Unexpected error message for invalid Connect: " + str(e))
     finally:
@@ -2828,7 +2828,7 @@ def test_dbus_p2p_invalid(dev, apdev):
         try:
             pin = p2p.Connect(args)
             raise Exception("Invalid Connect accepted")
-        except dbus.exceptions.DBusException, e:
+        except dbus.exceptions.DBusException as e:
             if "InvalidArgs" not in str(e):
                 raise Exception("Unexpected error message for invalid Connect: " + str(e))
 
@@ -2837,7 +2837,7 @@ def test_dbus_p2p_invalid(dev, apdev):
         args = { 'peer': path }
         pin = p2p.Invite(args)
         raise Exception("Invalid Invite accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "Error.Failed: P2P is not available for this interface" not in str(e):
             raise Exception("Unexpected error message for invalid Invite: " + str(e))
     finally:
@@ -2847,7 +2847,7 @@ def test_dbus_p2p_invalid(dev, apdev):
         args = { 'foo': 'bar' }
         pin = p2p.Invite(args)
         raise Exception("Invalid Invite accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "InvalidArgs" not in str(e):
             raise Exception("Unexpected error message for invalid Connect: " + str(e))
 
@@ -2870,7 +2870,7 @@ def test_dbus_p2p_invalid(dev, apdev):
         try:
             p2p.ProvisionDiscoveryRequest(p, method)
             raise Exception("Invalid ProvisionDiscoveryRequest accepted")
-        except dbus.exceptions.DBusException, e:
+        except dbus.exceptions.DBusException as e:
             if err not in str(e):
                 raise Exception("Unexpected error message for invalid ProvisionDiscoveryRequest: " + str(e))
 
@@ -2879,7 +2879,7 @@ def test_dbus_p2p_invalid(dev, apdev):
         if_obj.Get(WPAS_DBUS_IFACE_P2PDEVICE, "Peers",
                    dbus_interface=dbus.PROPERTIES_IFACE)
         raise Exception("Invalid Get(Peers) accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "Error.Failed: P2P is not available for this interface" not in str(e):
             raise Exception("Unexpected error message for invalid Get(Peers): " + str(e))
     finally:
@@ -3075,7 +3075,7 @@ def run_dbus_p2p_discovery(dev, apdev):
             try:
                 p2p.RejectPeer(path)
                 raise Exception("Invalid RejectPeer accepted")
-            except dbus.exceptions.DBusException, e:
+            except dbus.exceptions.DBusException as e:
                 if "UnknownError: Failed to call wpas_p2p_reject" not in str(e):
                     raise Exception("Unexpected error message for invalid RejectPeer(): " + str(e))
             self.loop.quit()
@@ -3121,7 +3121,7 @@ def run_dbus_p2p_discovery(dev, apdev):
     try:
         p2p.ExtendedListen(dbus.Dictionary({'foo': 100}))
         raise Exception("Invalid ExtendedListen accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "InvalidArgs" not in str(e):
             raise Exception("Unexpected error message for invalid ExtendedListen(): " + str(e))
 
@@ -3191,7 +3191,7 @@ def test_dbus_p2p_service_discovery(dev, apdev):
     try:
         p2p.DeleteService(args)
         raise Exception("Invalid DeleteService() accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "InvalidArgs" not in str(e):
             raise Exception("Unexpected error message for invalid DeleteService(): " + str(e))
 
@@ -3201,7 +3201,7 @@ def test_dbus_p2p_service_discovery(dev, apdev):
     try:
         p2p.DeleteService(args)
         raise Exception("Invalid DeleteService() accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "InvalidArgs" not in str(e):
             raise Exception("Unexpected error message for invalid DeleteService(): " + str(e))
 
@@ -3213,7 +3213,7 @@ def test_dbus_p2p_service_discovery(dev, apdev):
     try:
         p2p.DeleteService(args)
         raise Exception("Invalid DeleteService() accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "InvalidArgs" not in str(e):
             raise Exception("Unexpected error message for invalid DeleteService(): " + str(e))
 
@@ -3233,7 +3233,7 @@ def test_dbus_p2p_service_discovery(dev, apdev):
         try:
             p2p.DeleteService(args)
             raise Exception("Invalid DeleteService() accepted")
-        except dbus.exceptions.DBusException, e:
+        except dbus.exceptions.DBusException as e:
             if "InvalidArgs" not in str(e):
                 raise Exception("Unexpected error message for invalid DeleteService(): " + str(e))
 
@@ -3256,7 +3256,7 @@ def test_dbus_p2p_service_discovery(dev, apdev):
         try:
             p2p.AddService(args)
             raise Exception("Invalid AddService() accepted")
-        except dbus.exceptions.DBusException, e:
+        except dbus.exceptions.DBusException as e:
             if "InvalidArgs" not in str(e):
                 raise Exception("Unexpected error message for invalid AddService(): " + str(e))
 
@@ -3266,13 +3266,13 @@ def test_dbus_p2p_service_discovery(dev, apdev):
     try:
         p2p.ServiceDiscoveryCancelRequest(ref)
         raise Exception("Invalid ServiceDiscoveryCancelRequest() accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "InvalidArgs" not in str(e):
             raise Exception("Unexpected error message for invalid AddService(): " + str(e))
     try:
         p2p.ServiceDiscoveryCancelRequest(dbus.UInt64(0))
         raise Exception("Invalid ServiceDiscoveryCancelRequest() accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "InvalidArgs" not in str(e):
             raise Exception("Unexpected error message for invalid AddService(): " + str(e))
 
@@ -3307,7 +3307,7 @@ def test_dbus_p2p_service_discovery(dev, apdev):
         try:
             p2p.ServiceDiscoveryRequest(args)
             raise Exception("Invalid ServiceDiscoveryRequest accepted")
-        except dbus.exceptions.DBusException, e:
+        except dbus.exceptions.DBusException as e:
             if "InvalidArgs" not in str(e):
                 raise Exception("Unexpected error message for invalid ServiceDiscoveryRequest(): " + str(e))
 
@@ -3315,7 +3315,7 @@ def test_dbus_p2p_service_discovery(dev, apdev):
     try:
         p2p.ServiceDiscoveryResponse(dbus.Dictionary(args, signature='sv'))
         raise Exception("Invalid ServiceDiscoveryResponse accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "InvalidArgs" not in str(e):
             raise Exception("Unexpected error message for invalid ServiceDiscoveryResponse(): " + str(e))
 
@@ -3564,7 +3564,7 @@ def test_dbus_p2p_autogo(dev, apdev):
                 wps.Start(params)
                 self.exceptions = True
                 raise Exception("Invalid WPS.Start() accepted")
-            except dbus.exceptions.DBusException, e:
+            except dbus.exceptions.DBusException as e:
                 if "InvalidArgs" not in str(e):
                     self.exceptions = True
                     raise Exception("Unexpected error message: " + str(e))
@@ -3641,7 +3641,7 @@ def test_dbus_p2p_autogo(dev, apdev):
                           dbus_interface=dbus.PROPERTIES_IFACE)
                 self.exceptions = True
                 raise Exception("Invalid Set(WPSVendorExtensions) accepted")
-            except dbus.exceptions.DBusException, e:
+            except dbus.exceptions.DBusException as e:
                 if "Error.Failed" not in str(e):
                     self.exceptions = True
                     raise Exception("Unexpected error message for invalid Set(WPSVendorExtensions): " + str(e))
@@ -3652,7 +3652,7 @@ def test_dbus_p2p_autogo(dev, apdev):
                           dbus_interface=dbus.PROPERTIES_IFACE)
                 self.exceptions = True
                 raise Exception("Invalid Set(WPSVendorExtensions) accepted")
-            except dbus.exceptions.DBusException, e:
+            except dbus.exceptions.DBusException as e:
                 if "InvalidArgs" not in str(e):
                     self.exceptions = True
                     raise Exception("Unexpected error message for invalid Set(WPSVendorExtensions): " + str(e))
@@ -3663,7 +3663,7 @@ def test_dbus_p2p_autogo(dev, apdev):
                           dbus_interface=dbus.PROPERTIES_IFACE)
                 self.exceptions = True
                 raise Exception("Invalid Set(WPSVendorExtensions) accepted")
-            except dbus.exceptions.DBusException, e:
+            except dbus.exceptions.DBusException as e:
                 if "Error.Failed" not in str(e):
                     self.exceptions = True
                     raise Exception("Unexpected error message for invalid Set(WPSVendorExtensions): " + str(e))
@@ -3674,7 +3674,7 @@ def test_dbus_p2p_autogo(dev, apdev):
                           dbus_interface=dbus.PROPERTIES_IFACE)
                 self.exceptions = True
                 raise Exception("Invalid Set(WPSVendorExtensions) accepted")
-            except dbus.exceptions.DBusException, e:
+            except dbus.exceptions.DBusException as e:
                 if "Error.Failed" not in str(e):
                     self.exceptions = True
                     raise Exception("Unexpected error message for invalid Set(WPSVendorExtensions): " + str(e))
@@ -3953,7 +3953,7 @@ def test_dbus_p2p_join(dev, apdev):
                 g_obj.Set(WPAS_DBUS_GROUP, 'WPSVendorExtensions', res,
                           dbus_interface=dbus.PROPERTIES_IFACE)
                 raise Exception("Invalid Set(WPSVendorExtensions) accepted")
-            except dbus.exceptions.DBusException, e:
+            except dbus.exceptions.DBusException as e:
                 if "Error.Failed: Failed to set property" not in str(e):
                     raise Exception("Unexpected error message for invalid Set(WPSVendorExtensions): " + str(e))
 
@@ -4105,7 +4105,7 @@ def _test_dbus_p2p_config(dev, apdev):
                    dbus_interface=dbus.PROPERTIES_IFACE,
                    byte_arrays=True)
         raise Exception("Invalid Get(P2PDeviceConfig) accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "Error.Failed: P2P is not available for this interface" not in str(e):
             raise Exception("Unexpected error message for invalid Invite: " + str(e))
     finally:
@@ -4118,7 +4118,7 @@ def _test_dbus_p2p_config(dev, apdev):
                    dbus.Dictionary(changes, signature='sv'),
                    dbus_interface=dbus.PROPERTIES_IFACE)
         raise Exception("Invalid Set(P2PDeviceConfig) accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "Error.Failed: P2P is not available for this interface" not in str(e):
             raise Exception("Unexpected error message for invalid Invite: " + str(e))
     finally:
@@ -4133,7 +4133,7 @@ def _test_dbus_p2p_config(dev, apdev):
                        dbus.Dictionary(changes, signature='sv'),
                        dbus_interface=dbus.PROPERTIES_IFACE)
             raise Exception("Invalid Set(P2PDeviceConfig) accepted")
-        except dbus.exceptions.DBusException, e:
+        except dbus.exceptions.DBusException as e:
             if "InvalidArgs" not in str(e):
                 raise Exception("Unexpected error message for invalid Invite: " + str(e))
 
@@ -4226,7 +4226,7 @@ def test_dbus_p2p_persistent(dev, apdev):
     try:
         p2p.RemovePersistentGroup(persistent)
         raise Exception("Invalid RemovePersistentGroup accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "NetworkUnknown: There is no such persistent group" not in str(e):
             raise Exception("Unexpected error message for invalid RemovePersistentGroup: " + str(e))
 
@@ -4295,7 +4295,7 @@ def test_dbus_p2p_reinvoke_persistent(dev, apdev):
                 try:
                     pin = p2p.Invite(args)
                     raise Exception("Invalid Invite accepted")
-                except dbus.exceptions.DBusException, e:
+                except dbus.exceptions.DBusException as e:
                     if "InvalidArgs" not in str(e):
                         raise Exception("Unexpected error message for invalid Invite: " + str(e))
 
@@ -4412,7 +4412,7 @@ def test_dbus_p2p_go_neg_rx(dev, apdev):
             try:
                 p2p.Connect(args)
                 raise Exception("Invalid Connect accepted")
-            except dbus.exceptions.DBusException, e:
+            except dbus.exceptions.DBusException as e:
                 if "ConnectChannelUnsupported" not in str(e):
                     raise Exception("Unexpected error message for invalid Connect: " + str(e))
 
@@ -4494,7 +4494,7 @@ def test_dbus_p2p_go_neg_auth(dev, apdev):
             try:
                 p2p.Connect(args)
                 raise Exception("Invalid Connect accepted")
-            except dbus.exceptions.DBusException, e:
+            except dbus.exceptions.DBusException as e:
                 if "InvalidArgs" not in str(e):
                     raise Exception("Unexpected error message for invalid Connect: " + str(e))
 
@@ -5113,7 +5113,7 @@ def test_dbus_p2p_cancel(dev, apdev):
     try:
         p2p.Cancel()
         raise Exception("Unexpected p2p.Cancel() success")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         pass
 
     addr0 = dev[0].p2p_dev_addr()
@@ -5536,7 +5536,7 @@ def test_dbus_save_config(dev, apdev):
     try:
         iface.SaveConfig()
         raise Exception("SaveConfig() accepted unexpectedly")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if not str(e).startswith("fi.w1.wpa_supplicant1.UnknownError: Not allowed to update configuration"):
             raise Exception("Unexpected error message for SaveConfig(): " + str(e))
 
@@ -5557,7 +5557,7 @@ def _test_dbus_vendor_elem(dev, apdev):
         ie = dbus.ByteArray("\x00\x00")
         iface.VendorElemAdd(-1, ie)
         raise Exception("Invalid VendorElemAdd() accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "InvalidArgs" not in str(e) or "Invalid ID" not in str(e):
             raise Exception("Unexpected error message for invalid VendorElemAdd[1]: " + str(e))
 
@@ -5565,7 +5565,7 @@ def _test_dbus_vendor_elem(dev, apdev):
         ie = dbus.ByteArray("")
         iface.VendorElemAdd(1, ie)
         raise Exception("Invalid VendorElemAdd() accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "InvalidArgs" not in str(e) or "Invalid value" not in str(e):
             raise Exception("Unexpected error message for invalid VendorElemAdd[2]: " + str(e))
 
@@ -5573,21 +5573,21 @@ def _test_dbus_vendor_elem(dev, apdev):
         ie = dbus.ByteArray("\x00\x01")
         iface.VendorElemAdd(1, ie)
         raise Exception("Invalid VendorElemAdd() accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "InvalidArgs" not in str(e) or "Parse error" not in str(e):
             raise Exception("Unexpected error message for invalid VendorElemAdd[3]: " + str(e))
 
     try:
         iface.VendorElemGet(-1)
         raise Exception("Invalid VendorElemGet() accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "InvalidArgs" not in str(e) or "Invalid ID" not in str(e):
             raise Exception("Unexpected error message for invalid VendorElemGet[1]: " + str(e))
 
     try:
         iface.VendorElemGet(1)
         raise Exception("Invalid VendorElemGet() accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "InvalidArgs" not in str(e) or "ID value does not exist" not in str(e):
             raise Exception("Unexpected error message for invalid VendorElemGet[2]: " + str(e))
 
@@ -5595,7 +5595,7 @@ def _test_dbus_vendor_elem(dev, apdev):
         ie = dbus.ByteArray("\x00\x00")
         iface.VendorElemRem(-1, ie)
         raise Exception("Invalid VendorElemRemove() accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "InvalidArgs" not in str(e) or "Invalid ID" not in str(e):
             raise Exception("Unexpected error message for invalid VendorElemRemove[1]: " + str(e))
 
@@ -5603,7 +5603,7 @@ def _test_dbus_vendor_elem(dev, apdev):
         ie = dbus.ByteArray("")
         iface.VendorElemRem(1, ie)
         raise Exception("Invalid VendorElemRemove() accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "InvalidArgs" not in str(e) or "Invalid value" not in str(e):
             raise Exception("Unexpected error message for invalid VendorElemRemove[1]: " + str(e))
 
@@ -5634,7 +5634,7 @@ def _test_dbus_vendor_elem(dev, apdev):
         test_ie = dbus.ByteArray("\x01\x01")
         iface.VendorElemRem(1, test_ie)
         raise Exception("Invalid VendorElemRemove() accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "InvalidArgs" not in str(e) or "Parse error" not in str(e):
             raise Exception("Unexpected error message for invalid VendorElemRemove[1]: " + str(e))
 
@@ -5647,7 +5647,7 @@ def _test_dbus_vendor_elem(dev, apdev):
     try:
         iface.VendorElemGet(1)
         raise Exception("Invalid VendorElemGet() accepted after removal")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "InvalidArgs" not in str(e) or "ID value does not exist" not in str(e):
             raise Exception("Unexpected error message for invalid VendorElemGet after removal: " + str(e))
 
index 9034fdd27f50852c1c8e6c0735499b12d8a147aa..bb6043e7eeff0fc2b2d8333825eeafd35d9a70c8 100644 (file)
@@ -36,7 +36,7 @@ def prepare_dbus(dev):
         path = wpas.getInterface(dev.ifname)
         if_obj = bus.get_object(WPAS_DBUS_OLD_SERVICE, path)
         return (bus,wpas_obj,path,if_obj)
-    except Exception, e:
+    except Exception as e:
         raise HwsimSkip("Could not connect to D-Bus: %s" % e)
 
 class TestDbusOldWps(TestDbus):
@@ -83,7 +83,7 @@ def test_dbus_old(dev, apdev):
         try:
             if_obj.setAPScan(t, dbus_interface=WPAS_DBUS_OLD_IFACE)
             raise Exception("Invalid setAPScan() accepted")
-        except dbus.exceptions.DBusException, e:
+        except dbus.exceptions.DBusException as e:
             if "InvalidOptions" not in str(e):
                 raise Exception("Unexpected error message for invalid setAPScan: " + str(e))
 
@@ -93,7 +93,7 @@ def test_dbus_old(dev, apdev):
         try:
             obj.disable(dbus_interface=WPAS_DBUS_OLD_NETWORK)
             raise Exception("Invalid disable() accepted")
-        except dbus.exceptions.DBusException, e:
+        except dbus.exceptions.DBusException as e:
             if "InvalidNetwork" not in str(e):
                 raise Exception("Unexpected error message for invalid disable: " + str(e))
 
@@ -103,7 +103,7 @@ def test_dbus_old(dev, apdev):
         try:
             obj.properties(dbus_interface=WPAS_DBUS_OLD_BSSID)
             raise Exception("Invalid properties() accepted")
-        except dbus.exceptions.DBusException, e:
+        except dbus.exceptions.DBusException as e:
             if "InvalidBSSID" not in str(e):
                 raise Exception("Unexpected error message for invalid properties: " + str(e))
 
@@ -162,7 +162,7 @@ def test_dbus_old_scan(dev, apdev):
     try:
         bss_obj.properties2(dbus_interface=WPAS_DBUS_OLD_BSSID)
         raise Exception("Unknown BSSID method accepted")
-    except Exception, e:
+    except Exception as e:
         logger.debug("Unknown BSSID method exception: " + str(e))
 
     if not if_obj.flush(0, dbus_interface=WPAS_DBUS_OLD_IFACE):
@@ -175,13 +175,13 @@ def test_dbus_old_scan(dev, apdev):
     try:
         if_obj.flush("foo", dbus_interface=WPAS_DBUS_OLD_IFACE)
         raise Exception("Invalid flush arguments accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if not str(e).startswith("fi.epitest.hostap.WPASupplicant.InvalidOptions"):
             raise Exception("Unexpected error message for invalid flush: " + str(e))
     try:
         bss_obj.properties(dbus_interface=WPAS_DBUS_OLD_BSSID,
                            byte_arrays=True)
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if not str(e).startswith("fi.epitest.hostap.WPASupplicant.Interface.InvalidBSSID"):
             raise Exception("Unexpected error message for invalid BSS: " + str(e))
 
@@ -193,14 +193,14 @@ def test_dbus_old_debug(dev, apdev):
     try:
         wpas.setDebugParams(123)
         raise Exception("Invalid setDebugParams accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "InvalidOptions" not in str(e):
             raise Exception("Unexpected error message for invalid setDebugParam: " + str(e))
 
     try:
         wpas.setDebugParams(123, True, True)
         raise Exception("Invalid setDebugParams accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "InvalidOptions" not in str(e):
             raise Exception("Unexpected error message for invalid setDebugParam: " + str(e))
 
@@ -233,7 +233,7 @@ def test_dbus_old_smartcard(dev, apdev):
         try:
             if_obj.setSmartcardModules(t, dbus_interface=WPAS_DBUS_OLD_IFACE)
             raise Exception("Invalid setSmartcardModules accepted: " + str(t))
-        except dbus.exceptions.DBusException, e:
+        except dbus.exceptions.DBusException as e:
             if not str(e).startswith("fi.epitest.hostap.WPASupplicant.InvalidOptions"):
                 raise Exception("Unexpected error message for invalid setSmartcardModules(%s): %s" % (str(t), str(e)))
 
@@ -266,7 +266,7 @@ def test_dbus_old_interface(dev, apdev):
         try:
             wpas.getInterface(ifname)
             raise Exception("Invalid getInterface accepted")
-        except dbus.exceptions.DBusException, e:
+        except dbus.exceptions.DBusException as e:
             if err not in str(e):
                 raise Exception("Unexpected error message for invalid getInterface: " + str(e))
 
@@ -278,7 +278,7 @@ def test_dbus_old_interface(dev, apdev):
     try:
         wpas.removeInterface(path)
         raise Exception("Invalid removeInterface() accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "InvalidInterface" not in str(e):
             raise Exception("Unexpected error message for invalid removeInterface: " + str(e))
 
@@ -302,14 +302,14 @@ def test_dbus_old_interface(dev, apdev):
             else:
                 wpas.addInterface(ifname, params)
             raise Exception("Invalid addInterface accepted: " + str(params))
-        except dbus.exceptions.DBusException, e:
+        except dbus.exceptions.DBusException as e:
             if err not in str(e):
                 raise Exception("Unexpected error message for invalid addInterface(%s): %s" % (str(params), str(e)))
 
     try:
         wpas.removeInterface(123)
         raise Exception("Invalid removeInterface accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if not str(e).startswith("fi.epitest.hostap.WPASupplicant.InvalidOptions"):
             raise Exception("Unexpected error message for invalid removeInterface: " + str(e))
 
@@ -345,7 +345,7 @@ def test_dbus_old_blob(dev, apdev):
         try:
             if_obj.setBlobs(arg, dbus_interface=WPAS_DBUS_OLD_IFACE)
             raise Exception("Invalid setBlobs() accepted: " + str(arg))
-        except dbus.exceptions.DBusException, e:
+        except dbus.exceptions.DBusException as e:
             logger.debug("setBlobs(%s): %s" % (str(arg), str(e)))
             if err not in str(e):
                 raise Exception("Unexpected error message for invalid setBlobs: " + str(e))
@@ -358,7 +358,7 @@ def test_dbus_old_blob(dev, apdev):
         try:
             if_obj.removeBlobs(arg, dbus_interface=WPAS_DBUS_OLD_IFACE)
             raise Exception("Invalid removeBlobs() accepted: " + str(arg))
-        except dbus.exceptions.DBusException, e:
+        except dbus.exceptions.DBusException as e:
             logger.debug("removeBlobs(%s): %s" % (str(arg), str(e)))
             if err not in str(e):
                 raise Exception("Unexpected error message for invalid removeBlobs: " + str(e))
@@ -412,21 +412,21 @@ def test_dbus_old_connect(dev, apdev):
         try:
             if_obj.removeNetwork(obj, dbus_interface=WPAS_DBUS_OLD_IFACE)
             raise Exception("Invalid removeNetwork accepted: " + p)
-        except dbus.exceptions.DBusException, e:
+        except dbus.exceptions.DBusException as e:
             if not str(e).startswith("fi.epitest.hostap.WPASupplicant.Interface.InvalidNetwork"):
                 raise Exception("Unexpected error message for invalid removeNetwork: " + str(e))
 
     try:
         if_obj.removeNetwork("foo", dbus_interface=WPAS_DBUS_OLD_IFACE)
         raise Exception("Invalid removeNetwork accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if not str(e).startswith("fi.epitest.hostap.WPASupplicant.InvalidOptions"):
             raise Exception("Unexpected error message for invalid removeNetwork: " + str(e))
 
     try:
         if_obj.removeNetwork(path, dbus_interface=WPAS_DBUS_OLD_IFACE)
         raise Exception("Invalid removeNetwork accepted")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if not str(e).startswith("fi.epitest.hostap.WPASupplicant.Interface.InvalidNetwork"):
             raise Exception("Unexpected error message for invalid removeNetwork: " + str(e))
 
@@ -442,7 +442,7 @@ def test_dbus_old_connect(dev, apdev):
         try:
             if_obj.selectNetwork(t, dbus_interface=WPAS_DBUS_OLD_IFACE)
             raise Exception("Invalid selectNetwork accepted: " + str(t))
-        except dbus.exceptions.DBusException, e:
+        except dbus.exceptions.DBusException as e:
             if err not in str(e):
                 raise Exception("Unexpected error message for invalid selectNetwork(%s): %s" % (str(t), str(e)))
 
@@ -456,7 +456,7 @@ def test_dbus_old_connect(dev, apdev):
         try:
             netw_obj.set(t, dbus_interface=WPAS_DBUS_OLD_NETWORK)
             raise Exception("Invalid set() accepted: " + str(t))
-        except dbus.exceptions.DBusException, e:
+        except dbus.exceptions.DBusException as e:
             if "InvalidOptions" not in str(e):
                 raise Exception("Unexpected error message for invalid set: " + str(e))
     params = dbus.Dictionary({ 'ssid': ssid,
@@ -521,7 +521,7 @@ def test_dbus_old_connect(dev, apdev):
                         if_obj.removeNetwork(self.path,
                                              dbus_interface=WPAS_DBUS_OLD_IFACE)
                         raise Exception("Invalid removeNetwork accepted")
-                    except dbus.exceptions.DBusException, e:
+                    except dbus.exceptions.DBusException as e:
                         if not str(e).startswith("fi.epitest.hostap.WPASupplicant.Interface.InvalidNetwork"):
                             raise Exception("Unexpected error message for invalid wpsPbc: " + str(e))
 
@@ -637,7 +637,7 @@ def test_dbus_old_network_set(dev, apdev):
     try:
         netw_obj.set(params, dbus_interface=WPAS_DBUS_OLD_NETWORK)
         raise Exception("set succeeded with unexpected type")
-    except dbus.exceptions.DBusException, e:
+    except dbus.exceptions.DBusException as e:
         if "InvalidOptions" not in str(e):
             raise Exception("Unexpected error message for unexpected type: " + str(e))
 
@@ -662,7 +662,7 @@ def _test_dbus_old_wps_pbc(dev, apdev):
         try:
             if_obj.wpsPbc(arg, dbus_interface=WPAS_DBUS_OLD_IFACE)
             raise Exception("Invalid wpsPbc arguments accepted: " + str(arg))
-        except dbus.exceptions.DBusException, e:
+        except dbus.exceptions.DBusException as e:
             if not str(e).startswith("fi.epitest.hostap.WPASupplicant.InvalidOptions"):
                 raise Exception("Unexpected error message for invalid wpsPbc: " + str(e))
 
@@ -730,7 +730,7 @@ def _test_dbus_old_wps_pin(dev, apdev):
         try:
             if_obj.wpsPin(arg[0], arg[1], dbus_interface=WPAS_DBUS_OLD_IFACE)
             raise Exception("Invalid wpsPin arguments accepted: " + str(arg))
-        except dbus.exceptions.DBusException, e:
+        except dbus.exceptions.DBusException as e:
             if not str(e).startswith("fi.epitest.hostap.WPASupplicant.InvalidOptions"):
                 raise Exception("Unexpected error message for invalid wpsPbc: " + str(e))
 
@@ -784,7 +784,7 @@ def _test_dbus_old_wps_reg(dev, apdev):
         try:
             if_obj.wpsReg(arg[0], arg[1], dbus_interface=WPAS_DBUS_OLD_IFACE)
             raise Exception("Invalid wpsReg arguments accepted: " + str(arg))
-        except dbus.exceptions.DBusException, e:
+        except dbus.exceptions.DBusException as e:
             if not str(e).startswith("fi.epitest.hostap.WPASupplicant.InvalidOptions"):
                 raise Exception("Unexpected error message for invalid wpsPbc: " + str(e))
 
index 7d8b5f45c051235dd0cb07c96340937c89958c7c..f4c5af2a9083a9847422e36b27fe591c8e1aa389 100644 (file)
@@ -198,7 +198,7 @@ def test_fils_sk_pmksa_caching_ocv(dev, apdev, params):
     params['ocv'] = '1'
     try:
         hapd = hostapd.add_ap(apdev[0]['ifname'], params)
-    except Exception, e:
+    except Exception as e:
         if "Failed to set hostapd parameter ocv" in str(e):
             raise HwsimSkip("OCV not supported")
         raise
index 9244740cd76829b43b943ed0fadc0e17e17fc63b..0c0107cb2cdc0e8559faa5e39da4098cbc77aad8 100644 (file)
@@ -243,7 +243,7 @@ class FstLauncher:
                 try:
                     pid = int(pidtxt)
                     break
-                except Exception, e:
+                except Exception as e:
                     self.logger.debug("kill_pid: No valid PID found: %s" % str(e))
                     time.sleep(1)
             self.logger.debug("kill_pid %s --> pid %d" % (pidfile, pid))
@@ -257,7 +257,7 @@ class FstLauncher:
                     break
                 # Wait and check again
                 time.sleep(1)
-        except Exception, e:
+        except Exception as e:
             self.logger.debug("Didn't stop the pid=%d. Was it stopped already? (%s)" % (pid, str(e)))
 
 
index 4e182b97efa401135e6cb5fb69305828deb0cabc..7e7f096056f0e6d11c9670cd03fa322dc69bf865 100644 (file)
@@ -142,7 +142,7 @@ def fst_start_session(apdev, test_params, bad_param_type, start_on_ap,
                 sid = '-1'
             initiator.set_fst_parameters(llt=llt)
             initiator.configure_session(sid, new_iface, old_iface)
-    except Exception, e:
+    except Exception as e:
         if e.args[0].startswith("Cannot add FST session with groupid"):
             if bad_param_type == bad_param_group_id or bad_param_type == bad_param_session_add_no_params:
                 bad_parameter_detected = True
@@ -302,7 +302,7 @@ def fst_initiate_session(apdev, test_params, bad_param_type, init_on_ap):
             bad_parameter_detected = True
         else:
             initiator.initiate_session(sid, "accept")
-    except Exception, e:
+    except Exception as e:
         if e.args[0].startswith("Cannot initiate fst session"):
             if bad_param_type != bad_param_none:
                 bad_parameter_detected = True
@@ -364,7 +364,7 @@ def fst_transfer_session(apdev, test_params, bad_param_type, init_on_ap,
         elif bad_param_type == bad_param_session_transfer_bad_session_id:
             sid = '-1'
         initiator.transfer_session(sid)
-    except Exception, e:
+    except Exception as e:
         if e.args[0].startswith("Cannot transfer fst session"):
             if bad_param_type != bad_param_none:
                 bad_parameter_detected = True
@@ -427,7 +427,7 @@ def fst_tear_down_session(apdev, test_params, bad_param_type, init_on_ap):
             elif bad_param_type == bad_param_session_teardown_bad_session_id:
                 sid = '-1'
             initiator.teardown_session(sid)
-    except Exception, e:
+    except Exception as e:
         if e.args[0].startswith("Cannot tear down fst session"):
             if (bad_param_type == bad_param_session_teardown_no_params or
                 bad_param_type == bad_param_session_teardown_bad_session_id or
@@ -503,7 +503,7 @@ def fst_remove_session(apdev, test_params, remove_session_scenario, init_on_ap):
         elif remove_session_scenario == remove_scenario_bad_session_id:
             sid = '-1'
         initiator.remove_session(sid)
-    except Exception, e:
+    except Exception as e:
         if e.args[0].startswith("Cannot remove fst session"):
             if (remove_session_scenario == remove_scenario_no_params or
                 remove_session_scenario == remove_scenario_bad_session_id):
@@ -592,7 +592,7 @@ def fst_send_unexpected_frame(apdev, test_params, frame_type, send_from_ap, addi
             #fsts_id doesn't matter, no actual session exists
             sender.send_test_tear_down('0')
             receiver.wait_for_session_event(5)
-    except Exception, e:
+    except Exception as e:
         if e.args[0].startswith("No FST-EVENT-SESSION received"):
             if frame_type != frame_type_session_request:
                 frame_receive_timeout = True
@@ -716,7 +716,7 @@ def fst_bad_transfer(apdev, test_params, bad_scenario_type, init_on_ap):
             responder.wait_for_session_event(5, ["EVENT_FST_SESSION_STATE"])
         else:
             raise Exception("Unknown bad scenario identifier")
-    except Exception, e:
+    except Exception as e:
         if e.args[0].startswith("No FST-EVENT-SESSION received"):
             bad_parameter_detected = True
         if not bad_parameter_detected:
@@ -753,7 +753,7 @@ def test_fst_sta_connect_to_non_fst_ap(dev, apdev, test_params):
                 res_sta1_mbies.startswith("FAIL") or
                 res_sta2_mbies.startswith("FAIL")):
                 raise Exception("Failure. MB IEs must be present on the stations")
-        except Exception, e:
+        except Exception as e:
             logger.info(e)
             raise
         finally:
@@ -773,7 +773,7 @@ def test_fst_sta_connect_to_fst_ap(dev, apdev, test_params):
         res_sta2_mbies = sta2.get_local_mbies()
         if res_sta2_mbies == orig_sta2_mbies:
             raise Exception("Failure. MB IEs have not been updated")
-    except Exception, e:
+    except Exception as e:
         logger.info(e)
         raise
     finally:
@@ -792,7 +792,7 @@ def test_fst_ap_connect_to_fst_sta(dev, apdev, test_params):
         res_ap_mbies = ap1.get_local_mbies()
         if res_ap_mbies != orig_ap_mbies:
             raise Exception("Failure. MB IEs have been unexpectedly updated on the AP")
-    except Exception, e:
+    except Exception as e:
         logger.info(e)
         raise
     finally:
@@ -811,7 +811,7 @@ def test_fst_ap_connect_to_non_fst_sta(dev, apdev, test_params):
         res_ap_mbies = ap2.get_local_mbies()
         if res_ap_mbies != orig_ap_mbies:
             raise Exception("Failure. MB IEs have been unexpectedly updated on the AP")
-    except Exception, e:
+    except Exception as e:
         logger.info(e)
         raise
     finally:
@@ -839,7 +839,7 @@ def test_fst_second_sta_connect_to_non_fst_ap(dev, apdev, test_params):
                 res_sta1_mbies.startswith("FAIL") or
                 res_sta2_mbies.startswith("FAIL")):
                 raise Exception("Failure. MB IEs must be present on the stations")
-        except Exception, e:
+        except Exception as e:
             logger.info(e)
             raise
         finally:
@@ -869,7 +869,7 @@ def test_fst_second_sta_connect_to_fst_ap(dev, apdev, test_params):
                 res_sta1_mbies.startswith("FAIL") or
                 res_sta2_mbies.startswith("FAIL")):
                 raise Exception("Failure. MB IEs must be present on the stations")
-        except Exception, e:
+        except Exception as e:
             logger.info(e)
             raise
         finally:
@@ -900,7 +900,7 @@ def test_fst_disconnect_1_of_2_stas_from_non_fst_ap(dev, apdev, test_params):
                 res_sta1_mbies.startswith("FAIL") or
                 res_sta2_mbies.startswith("FAIL")):
                 raise Exception("Failure. MB IEs must be present on the stations")
-        except Exception, e:
+        except Exception as e:
             logger.info(e)
             raise
         finally:
@@ -931,7 +931,7 @@ def test_fst_disconnect_1_of_2_stas_from_fst_ap(dev, apdev, test_params):
                 res_sta1_mbies.startswith("FAIL") or
                 res_sta2_mbies.startswith("FAIL")):
                 raise Exception("Failure. MB IEs must be present on the stations")
-        except Exception, e:
+        except Exception as e:
             logger.info(e)
             raise
         finally:
@@ -964,7 +964,7 @@ def test_fst_disconnect_2_of_2_stas_from_non_fst_ap(dev, apdev, test_params):
                 res_sta1_mbies.startswith("FAIL") or
                 res_sta2_mbies.startswith("FAIL")):
                 raise Exception("Failure. MB IEs must be present on the stations")
-        except Exception, e:
+        except Exception as e:
             logger.info(e)
             raise
         finally:
@@ -1014,7 +1014,7 @@ def test_fst_disconnect_2_of_2_stas_from_fst_ap(dev, apdev, test_params):
                 addr_sta2_mbie1 != addr_sta2_mbie2 or
                 addr_sta2_mbie1 != addr_sta1_str):
                 raise Exception("Failure. STA Address in MB IEs should have been same as the other STA's")
-        except Exception, e:
+        except Exception as e:
             logger.info(e)
             raise
         finally:
@@ -1045,7 +1045,7 @@ def test_fst_disconnect_non_fst_sta(dev, apdev, test_params):
         res_ap_mbies = ap2.get_local_mbies()
         if res_ap_mbies != orig_ap_mbies:
             raise Exception("Failure. MB IEs have been unexpectedly updated on the AP")
-    except Exception, e:
+    except Exception as e:
         logger.info(e)
         raise
     finally:
@@ -1076,7 +1076,7 @@ def test_fst_disconnect_fst_sta(dev, apdev, test_params):
         res_ap_mbies = ap2.get_local_mbies()
         if res_ap_mbies != orig_ap_mbies:
             raise Exception("Failure. MB IEs have been unexpectedly updated on the AP")
-    except Exception, e:
+    except Exception as e:
         logger.info(e)
         raise
     finally:
@@ -1137,7 +1137,7 @@ def test_fst_dynamic_iface_attach(dev, apdev, test_params):
             res_sta2_mbies.startswith("FAIL") or
             res_ap2_mbies.startswith("FAIL")):
             raise Exception("Failure. MB IEs should have appeared on the station and on the AP")
-    except Exception, e:
+    except Exception as e:
         logger.info(e)
         raise
     finally:
@@ -1498,13 +1498,13 @@ def test_fst_ap_ctrl_iface(dev, apdev, test_params):
             ap1.send_iface_attach_request(ap1.iface, ap1.fst_group,
                                           ap1.fst_llt, ap1.fst_pri)
             raise Exception("Duplicate FST-ATTACH succeeded")
-        except Exception, e:
+        except Exception as e:
             if not str(e).startswith("Cannot attach"):
                 raise
 
         try:
             ap1.get_fsts_id_by_sid("123")
-        except Exception, e:
+        except Exception as e:
             if not str(e).startswith("Cannot get fsts_id for sid"):
                 raise
     finally:
@@ -2537,7 +2537,7 @@ def _test_fst_setup_mbie_diff(dev, apdev, test_params):
         with alloc_fail(hapd, 1, "mb_ies_by_info"):
             fst_setup_req(wpas, hglobal, 5180, apdev[0]['bssid'], req, stie,
                           mbie, no_wait=True)
-    except HwsimSkip, e:
+    except HwsimSkip as e:
         # Skip exception to allow proper cleanup
         pass
 
index ed64fd1bd0c51872a0581f88a97cb51dc0d222fc..f0010e434eabd8448351f77ea43d18a50ceb5ab4 100644 (file)
@@ -35,7 +35,7 @@ def hostapd_oom_loop(apdev, params, start_func="main"):
                 count += 1
                 if count == 5:
                     break
-        except Exception, e:
+        except Exception as e:
             logger.info("Iteration %d - %s" % (i, str(e)))
 
 @remote_compatible
@@ -57,7 +57,7 @@ def test_hostapd_oom_wpa2_psk(dev, apdev):
         try:
             hostapd.add_ap(apdev[1], params, timeout=2.5)
             raise Exception("Unexpected add_ap() success during OOM")
-        except Exception, e:
+        except Exception as e:
             if "Failed to enable hostapd" in str(e):
                 pass
             else:
index 2c58b2200f51c7870c0a8271bfce0dc6a25415e8..a9935dfb72b6695d13662fc75c2524b81c5c087f 100644 (file)
@@ -240,15 +240,15 @@ def test_ibss_wpa_none(dev):
     # mac80211 currently..
     try:
         hwsim_utils.test_connectivity(dev[0], dev[1])
-    except Exception, e:
+    except Exception as e:
         logger.info("Ignoring known connectivity failure: " + str(e))
     try:
         hwsim_utils.test_connectivity(dev[0], dev[2])
-    except Exception, e:
+    except Exception as e:
         logger.info("Ignoring known connectivity failure: " + str(e))
     try:
         hwsim_utils.test_connectivity(dev[1], dev[2])
-    except Exception, e:
+    except Exception as e:
         logger.info("Ignoring known connectivity failure: " + str(e))
 
     key_mgmt = dev[0].get_status_field("key_mgmt")
@@ -291,7 +291,7 @@ def test_ibss_wpa_none_ccmp(dev):
     # mac80211 currently..
     try:
         hwsim_utils.test_connectivity(dev[0], dev[1])
-    except Exception, e:
+    except Exception as e:
         logger.info("Ignoring known connectivity failure: " + str(e))
 
 def test_ibss_open(dev):
index 1b36e9faec2767ef30a9c6a96d39fc35f8fdf4e1..8de4bf05126170c935ef242026da57979b9a2573 100644 (file)
@@ -164,7 +164,7 @@ def add_wpas_interfaces(count=2):
             wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
             wpas.interface_add("veth%d" % i, driver="macsec_linux")
             wpa.append(wpas)
-    except Exception, e:
+    except Exception as e:
         if "Failed to add a dynamic wpa_supplicant interface" in str(e):
             raise HwsimSkip("macsec supported (wpa_supplicant CONFIG_MACSEC, CONFIG_MACSEC_LINUX; kernel CONFIG_MACSEC)")
         raise
index 3eb0f511c19e4b510b6956b8041a70f21ab34537..a36aee2ba6cf919276762585a29b8482a1fd3a9e 100644 (file)
@@ -528,7 +528,7 @@ def test_mbo_without_pmf(dev, apdev):
         # "MBO: PMF needs to be enabled whenever using WPA2 with MBO"
         hostapd.add_ap(apdev[0], params)
         raise Exception("AP setup succeeded unexpectedly")
-    except Exception, e:
+    except Exception as e:
         if "Failed to enable hostapd" in str(e):
             pass
         else:
index b76b6cfd5540d3313d596d1406c00e956ddff579..49fb8f0b5adb54779e178385586a2e88710fc644 100644 (file)
@@ -35,7 +35,7 @@ def ocv_setup_ap(apdev, params):
     params.update(hostapd.wpa2_params(ssid=ssid, passphrase=passphrase))
     try:
         hapd = hostapd.add_ap(apdev, params)
-    except Exception, e:
+    except Exception as e:
         if "Failed to set hostapd parameter ocv" in str(e):
             raise HwsimSkip("OCV not supported")
         raise
@@ -371,7 +371,7 @@ class APConnection:
         params["ocv"] = ap_ocv
         try:
             self.hapd = hostapd.add_ap(apdev, params)
-        except Exception, e:
+        except Exception as e:
             if "Failed to set hostapd parameter ocv" in str(e):
                 raise HwsimSkip("OCV not supported")
             raise
@@ -598,7 +598,7 @@ def test_wpa2_ocv_ap_retransmit_msg3(dev, apdev):
     params['wpa_disable_eapol_key_retries'] = "1"
     try:
         hapd = hostapd.add_ap(apdev[0], params)
-    except Exception, e:
+    except Exception as e:
         if "Failed to set hostapd parameter ocv" in str(e):
             raise HwsimSkip("OCV not supported")
         raise
@@ -731,7 +731,7 @@ class STAConnection:
 
         try:
             self.hapd = hostapd.add_ap(apdev, params)
-        except Exception, e:
+        except Exception as e:
             if "Failed to set hostapd parameter ocv" in str(e):
                 raise HwsimSkip("OCV not supported")
             raise
index bab3cc52153d969858c7a5ebb191fe08dbaf70f5..3683735d14d9e34d193b9aa2b08deedc6e2d9db6 100644 (file)
@@ -551,7 +551,7 @@ def test_go_neg_peers_force_diff_freq(dev, apdev):
     try:
        [i_res2, r_res2] = go_neg_pbc(i_dev=dev[0], i_intent=14, i_freq=5180,
                                      r_dev=dev[1], r_intent=0, r_freq=5200)
-    except Exception, e:
+    except Exception as e:
         return
     raise Exception("Unexpected group formation success")
 
index d13753107d518011433290f290e3af4759222da5..8a2a5e2faa6d0eb0d91c0132a806a404914a3c50 100644 (file)
@@ -22,7 +22,7 @@ def get_rfkill(dev):
         for r, s, h in RFKill.list():
             if r.name == phy:
                 return r
-    except Exception, e:
+    except Exception as e:
         raise HwsimSkip("No rfkill available: " + str(e))
     raise HwsimSkip("No rfkill match found for the interface")
 
index 343a4e3fc05db3248ea05ffc2fab02ec12121a0a..e498672c39dad49c8b7c3efb4e4fa644a2837ce8 100644 (file)
@@ -1247,7 +1247,7 @@ def test_rrm_beacon_req_table_vht(dev, apdev):
             elif report.bssid_str == apdev[1]['bssid']:
                 if report.opclass != 117 or report.channel != 48:
                     raise Exception("Incorrect opclass/channel for AP1")
-    except Exception, e:
+    except Exception as e:
         if isinstance(e, Exception) and str(e) == "AP startup failed":
             if not vht_supported():
                 raise HwsimSkip("80 MHz channel not supported in regulatory information")
@@ -1662,7 +1662,7 @@ def test_rrm_beacon_req_passive_scan_vht(dev, apdev):
         logger.info("Received beacon report: " + str(report))
         if report.opclass != 128 or report.channel != 36:
             raise Exception("Incorrect opclass/channel for AP")
-    except Exception, e:
+    except Exception as e:
         if isinstance(e, Exception) and str(e) == "AP startup failed":
             if not vht_supported():
                 raise HwsimSkip("80 MHz channel not supported in regulatory information")
@@ -1712,7 +1712,7 @@ def test_rrm_beacon_req_passive_scan_vht160(dev, apdev):
         logger.info("Received beacon report: " + str(report))
         if report.opclass != 129 or report.channel != 104:
             raise Exception("Incorrect opclass/channel for AP")
-    except Exception, e:
+    except Exception as e:
         if isinstance(e, Exception) and str(e) == "AP startup failed":
             raise HwsimSkip("ZA regulatory rule likely did not have DFS requirement removed")
         raise
index 9c1c0c883ec37b40b3381fa38eff3cff7b856ac3..2bf3451efbf4d9a6dd9ffdeb98d35817d7f42249 100644 (file)
@@ -21,7 +21,7 @@ def get_wext_interface():
     wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
     try:
         wpas.interface_add("wlan5", driver="wext")
-    except Exception, e:
+    except Exception as e:
         wpas.close_ctrl()
         raise HwsimSkip("WEXT driver support not included in wpa_supplicant")
     return wpas
index d07d5aca2a89ec1860b5a21adaef3d5fef7ab879..26a7521e7cd790c85b07da4ca9a545783b38e22a 100644 (file)
@@ -70,7 +70,7 @@ def get_wmediumd_version():
 
     try:
         verstr = subprocess.check_output(['wmediumd', '-V'])
-    except OSError, e:
+    except OSError as e:
         if e.errno == errno.ENOENT:
             raise HwsimSkip('wmediumd not available')
         raise
@@ -101,7 +101,7 @@ def start_wmediumd(fn, params):
         p = subprocess.Popen(['wmediumd', '-c', fn],
                              stdout=subprocess.PIPE,
                              stderr=subprocess.STDOUT)
-    except OSError, e:
+    except OSError as e:
         if e.errno == errno.ENOENT:
             raise HwsimSkip('wmediumd not available')
         raise
index 2f8a25034750e76f2bb83a7d17afe4fddd02fd69..192761633ce8e52343a735f33f8d90016fd65e7a 100644 (file)
@@ -310,7 +310,7 @@ def test_wnm_sleep_mode_rsn_ocv(dev, apdev):
     params["bss_transition"] = "1"
     try:
         hapd = hostapd.add_ap(apdev[0], params)
-    except Exception, e:
+    except Exception as e:
         if "Failed to set hostapd parameter ocv" in str(e):
             raise HwsimSkip("OCV not supported")
         raise
@@ -343,7 +343,7 @@ def test_wnm_sleep_mode_rsn_badocv(dev, apdev):
     params['wnm_sleep_mode'] = '1'
     try:
         hapd = hostapd.add_ap(apdev[0], params)
-    except Exception, e:
+    except Exception as e:
         if "Failed to set hostapd parameter ocv" in str(e):
             raise HwsimSkip("OCV not supported")
         raise
index f8b501a1f501c8e583df208bba9c33c16072a609..d1b97634bac4b3f6e4a6e736572dca5a31d253d4 100644 (file)
@@ -94,7 +94,7 @@ def test_wpas_ctrl_network(dev):
         res = dev[0].get_network(id, "key_mgmt")
         if res != value:
             raise Exception("Unexpected response for key_mgmt")
-    except Exception, e:
+    except Exception as e:
         if str(e).startswith("Unexpected"):
             raise
         else:
@@ -1827,7 +1827,7 @@ def test_wpas_ctrl_socket_full(dev, apdev, test_params):
         logger.debug("Command %d" % i)
         try:
             s.send("MIB")
-        except Exception, e:
+        except Exception as e:
             logger.info("Could not send command %d: %s" % (i, str(e)))
             break
         # Close without receiving response
@@ -1846,7 +1846,7 @@ def test_wpas_ctrl_socket_full(dev, apdev, test_params):
         logger.debug("Command %d [2]" % i)
         try:
             s2.send("MIB")
-        except Exception, e:
+        except Exception as e:
             logger.info("Could not send command %d [2]: %s" % (i, str(e)))
             break
         # Close without receiving response
@@ -1859,7 +1859,7 @@ def test_wpas_ctrl_socket_full(dev, apdev, test_params):
         logger.debug("Command %d [3]" % i)
         try:
             s2.send("MIB")
-        except Exception, e:
+        except Exception as e:
             logger.info("Could not send command %d [3]: %s" % (i, str(e)))
             break
         # Close without receiving response
index c20d5da6c10c5e8f0a23b6b9bebbe872a226c3ec..45317d0d35a1ba28b85f6b6c85bd0888007185f2 100644 (file)
@@ -303,7 +303,7 @@ def add_mesh_secure_net(dev, psk=True, pmf=False, pairwise=None, group=None,
     if ocv:
         try:
             dev.set_network(id, "ocv", "1")
-        except Exception, e:
+        except Exception as e:
             if "SET_NETWORK failed" in str(e):
                 raise HwsimSkip("OCV not supported")
             raise
@@ -1264,7 +1264,7 @@ def test_wpas_mesh_password_mismatch(dev, apdev):
         try:
             hwsim_utils.test_connectivity(dev[i], dev[2], timeout=1)
             raise Exception("Data connectivity test passed unexpectedly")
-        except Exception, e:
+        except Exception as e:
             if "data delivery failed" not in str(e):
                 raise
 
@@ -1713,7 +1713,7 @@ def test_mesh_oom(dev, apdev):
                                         "MESH-GROUP-STARTED"])
                 if ev is None:
                     raise Exception("Init failure not reported")
-        except Exception, e:
+        except Exception as e:
             if i < 15:
                 raise
             logger.info("Ignore no-oom for i=%d" % i)
index 149dd72338e842eefb01e27c5afe649d2040acc8..f81588a1824e402985e35a87403ef942fb71c860 100644 (file)
@@ -60,7 +60,7 @@ def test_tspec(dev, apdev):
     try:
         dev[0].add_ts(tsid, 3)
         raise Exception("ADDTS succeeded although it should have failed")
-    except Exception, e:
+    except Exception as e:
         if not str(e).startswith("ADDTS failed"):
             raise
     status = dev[0].request("WMM_AC_STATUS")
@@ -77,7 +77,7 @@ def test_tspec(dev, apdev):
     try:
         dev[0].add_ts(tsid, 5)
         raise Exception("ADDTS succeeded although it should have failed")
-    except Exception, e:
+    except Exception as e:
         if not str(e).startswith("ADDTS failed"):
             raise
 
@@ -93,13 +93,13 @@ def test_tspec(dev, apdev):
     try:
         dev[0].add_ts(tsid, 7, direction="uplink")
         raise Exception("ADDTS succeeded although it should have failed")
-    except Exception, e:
+    except Exception as e:
         if not str(e).startswith("ADDTS failed"):
             raise
     try:
         dev[0].add_ts(tsid, 7, direction="bidi")
         raise Exception("ADDTS succeeded although it should have failed")
-    except Exception, e:
+    except Exception as e:
         if not str(e).startswith("ADDTS failed"):
             raise
 
@@ -107,7 +107,7 @@ def test_tspec(dev, apdev):
     try:
         dev[0].del_ts(tsid)
         raise Exception("DELTS succeeded although it should have failed")
-    except Exception, e:
+    except Exception as e:
         if not str(e).startswith("DELTS failed"):
             raise
 
@@ -231,7 +231,7 @@ def test_tspec_not_enabled(dev, apdev):
     try:
         dev[0].add_ts(5, 6)
         raise Exception("ADDTS succeeded although it should have failed")
-    except Exception, e:
+    except Exception as e:
         if not str(e).startswith("ADDTS failed"):
             raise
 
@@ -239,7 +239,7 @@ def test_tspec_not_enabled(dev, apdev):
     try:
         dev[0].del_ts(5)
         raise Exception("DELTS succeeded although it should have failed")
-    except Exception, e:
+    except Exception as e:
         if not str(e).startswith("DELTS failed"):
             raise
 
index b90f66258672a537be8c9a443d2f476f5c2b9286..81aee6c4b92939b015245f70ed46ac9abfbe2251 100644 (file)
@@ -39,7 +39,7 @@ def _run_tshark(filename, filter, display=None, wait=True):
             arg.append('-V')
         cmd = subprocess.Popen(arg, stdout=subprocess.PIPE,
                                stderr=subprocess.PIPE)
-    except Exception, e:
+    except Exception as e:
         logger.info("Could run run tshark check: " + str(e))
         cmd = None
         return None
@@ -88,7 +88,7 @@ def run_tshark(filename, filter, display=None, wait=True):
     if display is None: display = []
     try:
         return _run_tshark(filename, filter, display, wait)
-    except UnknownFieldsException, e:
+    except UnknownFieldsException as e:
         all_wlan_mgt = True
         for f in e.fields:
             if not f.startswith('wlan_mgt.'):
@@ -108,7 +108,7 @@ def run_tshark_json(filename, filter):
     try:
         cmd = subprocess.Popen(arg, stdout=subprocess.PIPE,
                                stderr=subprocess.PIPE)
-    except Exception, e:
+    except Exception as e:
         logger.info("Could run run tshark: " + str(e))
         return None
     output = cmd.communicate()
index 10bb45fea282c6576142cfea7471f1609e7f171f..75dcdb5683c2d5fb1b7f5247f3150fb7db60c470 100644 (file)
@@ -142,7 +142,7 @@ class Wlantest:
     def get_bss_counter(self, field, bssid):
         try:
             res = self.cli_cmd(["get_bss_counter", field, bssid])
-        except Exception, e:
+        except Exception as e:
             return 0
         if "FAIL" in res:
             return 0
index 1698fca7a348cb98b57a5bbaaca7ba6ec09cdde2..5b57b76c36ec0cfea82457bcefdd09a77d54433d 100644 (file)
@@ -438,7 +438,7 @@ class WpaSupplicant:
             try:
                 [name,value] = l.split('=', 1)
                 vals[name] = value
-            except ValueError, e:
+            except ValueError as e:
                 logger.info(self.ifname + ": Ignore unexpected STATUS line: " + l)
         return vals
 
@@ -507,7 +507,7 @@ class WpaSupplicant:
             try:
                 [name,value] = l.split('=', 1)
                 vals[name] = value
-            except ValueError, e:
+            except ValueError as e:
                 logger.info(self.ifname + ": Ignore unexpected MIB line: " + l)
         return vals
 
index b438815421d63855177438c6ebcb9368aa6e0129..5ea2bd1e28a1263d573e9519c2f3c0c8dee0637a 100755 (executable)
@@ -265,7 +265,7 @@ def main():
     # lock devices
     try:
         get_devices(devices, duts, refs, monitors)
-    except Exception, e:
+    except Exception as e:
         logger.warning("get devices failed: " + str(e))
         logger.info(traceback.format_exc())
         put_devices(devices, duts, refs, monitors)
@@ -288,7 +288,7 @@ def main():
     logger.warning("RUN check_devices")
     try:
         check_devices(devices, setup_params, refs, duts, monitors)
-    except Exception, e:
+    except Exception as e:
         logger.warning("FAILED: " + str(e))
         logger.info(traceback.format_exc())
         put_devices(devices, duts, refs, monitors)
@@ -317,10 +317,10 @@ def main():
         except KeyboardInterrupt:
             put_devices(devices, duts, refs, monitors)
             raise
-        except TestSkip, e:
+        except TestSkip as e:
             end = datetime.now()
             logger.warning("SKIP (" + str(e) + ") - " + str((end - start).total_seconds()) + "s")
-        except Exception, e:
+        except Exception as e:
             end = datetime.now()
             logger.warning("FAILED (" + str(e) + ") - " + str((end - start).total_seconds()) + "s")
             logger.info(traceback.format_exc())
@@ -344,11 +344,11 @@ def main():
         except KeyboardInterrupt:
             put_devices(devices, duts, refs, monitors)
             raise
-        except HwsimSkip,e:
+        except HwsimSkip as e:
             end = datetime.now()
             logger.warning("SKIP (" + str(e) + ") - " + str((end - start).total_seconds()) + "s")
             failed.append(hwsim_test.__name__.replace('test_', '', 1))
-        except Exception, e:
+        except Exception as e:
             end = datetime.now()
             logger.warning("FAILED (" + str(e) + ") - " + str((end - start).total_seconds()) + "s")
             logger.info(traceback.format_exc())
index e2a00c9108126466a3418a87f69b1c75e8846348..f40f96198efa24ece27de6a94507262a3b1e9e26 100755 (executable)
@@ -24,7 +24,7 @@ def wpas_connect():
     if os.path.isdir(wpas_ctrl):
         try:
             ifaces = [os.path.join(wpas_ctrl, i) for i in os.listdir(wpas_ctrl)]
-        except OSError, error:
+        except OSError as error:
             print "Could not find wpa_supplicant: ", error
             return None
 
@@ -36,7 +36,7 @@ def wpas_connect():
         try:
             wpas = wpaspy.Ctrl(ctrl)
             return wpas
-        except Exception, e:
+        except Exception as e:
             pass
     return None
 
index 91eba28908edca9177a87a2925f8d19ac70a21e0..646f452ea6c456b2ad601677f272005122312a5f 100755 (executable)
@@ -53,7 +53,7 @@ def wpas_connect():
     if os.path.isdir(wpas_ctrl):
         try:
             ifaces = [os.path.join(wpas_ctrl, i) for i in os.listdir(wpas_ctrl)]
-        except OSError, error:
+        except OSError as error:
             print "Could not find wpa_supplicant: ", error
             return None
 
@@ -69,7 +69,7 @@ def wpas_connect():
             print "Trying to use control interface " + ctrl
             wpas = wpaspy.Ctrl(ctrl)
             return wpas
-        except Exception, e:
+        except Exception as e:
             pass
     return None
 
@@ -169,7 +169,7 @@ def p2p_handover_client(llc):
         print "Handover request (pre-WPS):"
         try:
             print message.pretty()
-        except Exception, e:
+        except Exception as e:
             print e
 
         data = wpas_get_handover_req_wps()
@@ -181,7 +181,7 @@ def p2p_handover_client(llc):
     print "Handover request:"
     try:
         print message.pretty()
-    except Exception, e:
+    except Exception as e:
         print e
     print str(message).encode("hex")
 
@@ -194,7 +194,7 @@ def p2p_handover_client(llc):
         summary("Handover connection refused")
         client.close()
         return
-    except Exception, e:
+    except Exception as e:
         summary("Other exception: " + str(e))
         client.close()
         return
@@ -220,14 +220,14 @@ def p2p_handover_client(llc):
     print "Received message"
     try:
         print message.pretty()
-    except Exception, e:
+    except Exception as e:
         print e
     print str(message).encode("hex")
     message = nfc.ndef.HandoverSelectMessage(message)
     summary("Handover select received")
     try:
         print message.pretty()
-    except Exception, e:
+    except Exception as e:
         print e
 
     for carrier in message.carriers:
@@ -286,7 +286,7 @@ class HandoverServer(nfc.handover.HandoverServer):
         print "HandoverServer - request received"
         try:
             print "Parsed handover request: " + request.pretty()
-        except Exception, e:
+        except Exception as e:
             print e
 
         sel = nfc.ndef.HandoverSelectMessage(version="1.2")
@@ -302,7 +302,7 @@ class HandoverServer(nfc.handover.HandoverServer):
                 print "Carrier record:"
                 try:
                     print carrier.record.pretty()
-                except Exception, e:
+                except Exception as e:
                     print e
                 data = wpas_get_handover_sel()
                 if data is None:
@@ -332,7 +332,7 @@ class HandoverServer(nfc.handover.HandoverServer):
                 print "Carrier record:"
                 try:
                     print carrier.record.pretty()
-                except Exception, e:
+                except Exception as e:
                     print e
                 data = wpas_get_handover_sel_wps()
                 if data is None:
@@ -355,7 +355,7 @@ class HandoverServer(nfc.handover.HandoverServer):
         print "Handover select:"
         try:
             print sel.pretty()
-        except Exception, e:
+        except Exception as e:
             print e
         print str(sel).encode("hex")
 
@@ -443,7 +443,7 @@ def wps_write_p2p_handover_sel(clf, wait_remove=True):
     print "Handover select:"
     try:
         print p2p_sel_data.pretty()
-    except Exception, e:
+    except Exception as e:
         print e
     print str(p2p_sel_data).encode("hex")
 
@@ -459,7 +459,7 @@ def rdwr_connected(tag):
         print "NDEF tag: " + tag.type
         try:
             print tag.ndef.message.pretty()
-        except Exception, e:
+        except Exception as e:
             print e
         success = p2p_tag_read(tag)
         if only_one and success:
@@ -636,7 +636,7 @@ def main():
                                              'on-connect': llcp_connected},
                                        terminate=terminate_loop):
                         break
-            except Exception, e:
+            except Exception as e:
                 print "clf.connect failed"
 
             global srv
index 59b0a9d364629a469b79b1f112dad8021b3f2dd1..cb1208117e0294dcd46a467f4f92d4cd84208a43 100644 (file)
@@ -118,7 +118,7 @@ class P2P_Connect():
                                        {'Ifname': ifname, 'Driver': 'test'})
                                time.sleep(1)
 
-                       except dbus.DBusException, exc:
+                       except dbus.DBusException as exc:
                                if not str(exc).startswith(
                                        self.wpas_dbus_interface + \
                                        ".InterfaceExists:"):
@@ -209,7 +209,7 @@ class P2P_Connect():
                        result_pin = self.p2p_interface.Connect(
                                self.p2p_connect_arguements)
 
-               except dbus.DBusException, exc:
+               except dbus.DBusException as exc:
                                raise exc
 
                if (self.wps_method == 'pin' and \
index c3e39b3de285f114e6eb3f42c9177ef958c81d67..9ea2c5c38ae21ec4fc6112f6f1cfbe270238727d 100644 (file)
@@ -81,7 +81,7 @@ class P2P_Disconnect (threading.Thread):
                try:
                        self.path = self.wpas.GetInterface(
                                        self.interface_name)
-               except dbus.DBusException, exc:
+               except dbus.DBusException as exc:
                        error = 'Error:\n  Interface ' + self.interface_name \
                                + ' was not found'
                        print error
index 973d46ab0f4b9d005368a54bfebe83b35f26a891..9c860d1e13a36b02193f43af1f61161801d9f3e3 100644 (file)
@@ -85,7 +85,7 @@ class P2P_Find (threading.Thread):
                try:
                        self.path = self.wpas.GetInterface(
                                        self.interface_name)
-               except dbus.DBusException, exc:
+               except dbus.DBusException as exc:
                        error = 'Error:\n  Interface ' + self.interface_name \
                                + ' was not found'
                        print error
index ff8509d6053d5644db8fa7b15371a70ba74991ff..5dfe642c9f9d9bcc476d5f79e30d6796d91b9723 100644 (file)
@@ -81,7 +81,7 @@ class P2P_Flush (threading.Thread):
                try:
                        self.path = self.wpas.GetInterface(
                                        self.interface_name)
-               except dbus.DBusException, exc:
+               except dbus.DBusException as exc:
                        error = 'Error:\n  Interface ' + self.interface_name \
                                + ' was not found'
                        print error
index 5c8fdafdfd9a317cb9c5db20ff382c0b0284f16e..4e64892cde866613f4f5a8c2be18089e19b77d39 100644 (file)
@@ -99,7 +99,7 @@ class P2P_Group_Add (threading.Thread):
                try:
                        self.path = self.wpas.GetInterface(
                                        self.interface_name)
-               except dbus.DBusException, exc:
+               except dbus.DBusException as exc:
                        error = 'Error:\n  Interface ' + self.interface_name \
                                + ' was not found'
                        print error
index 6deb397eca838c311cd8204f4533a9efaa410c59..9413f02272c0c07988a5fabc6b3a3b78604d95c3 100644 (file)
@@ -96,7 +96,7 @@ class P2P_Invite (threading.Thread):
                try:
                        self.path = self.wpas.GetInterface(
                                        self.interface_name)
-               except dbus.DBusException, exc:
+               except dbus.DBusException as exc:
                        error = 'Error:\n  Interface ' + self.interface_name \
                                + ' was not found'
                        print error
index bb3c1e49d5f12d2365de27a3003fa253f3c94951..1dd61f69c71c518a0dfbc192490baf61d4aa3d7e 100644 (file)
@@ -82,7 +82,7 @@ class P2P_Listen(threading.Thread):
                try:
                        self.path = self.wpas.GetInterface(
                                        self.interface_name)
-               except dbus.DBusException, exc:
+               except dbus.DBusException as exc:
                        error = 'Error:\n  Interface ' + self.interface_name \
                                + ' was not found'
                        print error
index f6c03b0272282a32a268064e83cfcddeaacac03d..31b54dde0fd4950825b1f33bdb63b252894716e6 100644 (file)
@@ -83,7 +83,7 @@ class P2P_Stop_Find (threading.Thread):
                try:
                        self.path = self.wpas.GetInterface(
                                        self.interface_name)
-               except dbus.DBusException, exc:
+               except dbus.DBusException as exc:
                        error = 'Error:\n  Interface ' + self.interface_name \
                                + ' was not found'
                        print error
index 25072ce9a2dfb82872f5a166f40064710401e776..885262c7ff729f4a11c7c68714c504f93b7af65a 100755 (executable)
@@ -123,14 +123,14 @@ def main():
        path = None
        try:
                path = wpas.GetInterface(ifname)
-       except dbus.DBusException, exc:
+       except dbus.DBusException as exc:
                if not str(exc).startswith("fi.w1.wpa_supplicant1.InterfaceUnknown:"):
                        raise exc
                try:
                        path = wpas.CreateInterface({'Ifname': ifname, 'Driver': 'test'})
                        time.sleep(1)
 
-               except dbus.DBusException, exc:
+               except dbus.DBusException as exc:
                        if not str(exc).startswith("fi.w1.wpa_supplicant1.InterfaceExists:"):
                                raise exc
 
index fd7f73d428b85c7ab457c05b26cd0c5e844f3e39..31713ca62df306e8adf6e86c9aed84ffc6e0bf62 100755 (executable)
@@ -37,12 +37,12 @@ def main():
        path = None
        try:
                path = wpas.getInterface(ifname)
-       except dbus.dbus_bindings.DBusException, exc:
+       except dbus.dbus_bindings.DBusException as exc:
                if str(exc) != "wpa_supplicant knows nothing about this interface.":
                        raise exc
                try:
                        path = wpas.addInterface(ifname, {'driver': dbus.Variant('wext')})
-               except dbus.dbus_bindings.DBusException, exc:
+               except dbus.dbus_bindings.DBusException as exc:
                        if str(exc) != "wpa_supplicant already controls this interface.":
                                raise exc
 
index 7459eb9ae5744b6adaa5fbd9724723f299fbf285..2e6869311c397a9c0f5cfa9ae6b290ae47c10e22 100755 (executable)
@@ -46,7 +46,7 @@ def wpas_connect():
     if os.path.isdir(wpas_ctrl):
         try:
             ifaces = [os.path.join(wpas_ctrl, i) for i in os.listdir(wpas_ctrl)]
-        except OSError, error:
+        except OSError as error:
             print "Could not find wpa_supplicant: ", error
             return None
 
@@ -58,7 +58,7 @@ def wpas_connect():
         try:
             wpas = wpaspy.Ctrl(ctrl)
             return wpas
-        except Exception, e:
+        except Exception as e:
             pass
     return None
 
@@ -164,7 +164,7 @@ class HandoverServer(nfc.handover.HandoverServer):
         summary("HandoverServer - request received")
         try:
             print "Parsed handover request: " + request.pretty()
-        except Exception, e:
+        except Exception as e:
             print e
 
         sel = nfc.ndef.HandoverSelectMessage(version="1.2")
@@ -191,7 +191,7 @@ class HandoverServer(nfc.handover.HandoverServer):
         print "Handover select:"
         try:
             print sel.pretty()
-        except Exception, e:
+        except Exception as e:
             print e
         print str(sel).encode("hex")
 
@@ -217,7 +217,7 @@ def wps_handover_init(llc):
     print "Handover request:"
     try:
         print message.pretty()
-    except Exception, e:
+    except Exception as e:
         print e
     print str(message).encode("hex")
 
@@ -230,7 +230,7 @@ def wps_handover_init(llc):
         summary("Handover connection refused")
         client.close()
         return
-    except Exception, e:
+    except Exception as e:
         summary("Other exception: " + str(e))
         client.close()
         return
@@ -256,14 +256,14 @@ def wps_handover_init(llc):
     print "Received message"
     try:
         print message.pretty()
-    except Exception, e:
+    except Exception as e:
         print e
     print str(message).encode("hex")
     message = nfc.ndef.HandoverSelectMessage(message)
     summary("Handover select received")
     try:
         print message.pretty()
-    except Exception, e:
+    except Exception as e:
         print e
 
     for carrier in message.carriers:
@@ -376,7 +376,7 @@ def rdwr_connected(tag):
         print "NDEF tag: " + tag.type
         try:
             print tag.ndef.message.pretty()
-        except Exception, e:
+        except Exception as e:
             print e
         success = wps_tag_read(tag, not only_one)
         if only_one and success:
@@ -507,7 +507,7 @@ def main():
                                          'on-connect': llcp_connected},
                                    terminate=terminate_loop):
                     break
-            except Exception, e:
+            except Exception as e:
                 print "clf.connect failed"
 
             global srv
index 9141a8d404f1d1d677d4e91b1591789941323b7e..cdfa71b0092143fe8e7aa13bbda3a85ec830df76 100755 (executable)
@@ -27,7 +27,7 @@ def wpas_connect(host=None, port=9877):
     if os.path.isdir(wpas_ctrl):
         try:
             ifaces = [os.path.join(wpas_ctrl, i) for i in os.listdir(wpas_ctrl)]
-        except OSError, error:
+        except OSError as error:
             print "Could not find wpa_supplicant: ", error
             return None
 
@@ -39,7 +39,7 @@ def wpas_connect(host=None, port=9877):
         try:
             wpas = wpaspy.Ctrl(ctrl)
             return wpas
-        except Exception, e:
+        except Exception as e:
             pass
     return None