aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xhostapd/wps-ap-nfc.py12
-rw-r--r--tests/hwsim/fst_module_aux.py2
-rw-r--r--tests/hwsim/hwsim.py2
-rw-r--r--tests/hwsim/hwsim_utils.py2
-rw-r--r--tests/hwsim/p2p_utils.py4
-rwxr-xr-xtests/hwsim/run-tests.py28
-rw-r--r--tests/hwsim/test_ap_ciphers.py4
-rw-r--r--tests/hwsim/test_ap_dynamic.py4
-rw-r--r--tests/hwsim/test_ap_eap.py4
-rw-r--r--tests/hwsim/test_ap_ft.py4
-rw-r--r--tests/hwsim/test_ap_hs20.py4
-rw-r--r--tests/hwsim/test_ap_open.py2
-rw-r--r--tests/hwsim/test_ap_params.py2
-rw-r--r--tests/hwsim/test_ap_pmf.py6
-rw-r--r--tests/hwsim/test_ap_tdls.py6
-rw-r--r--tests/hwsim/test_ap_vht.py32
-rw-r--r--tests/hwsim/test_ap_vlan.py2
-rw-r--r--tests/hwsim/test_ap_wps.py26
-rw-r--r--tests/hwsim/test_dbus.py234
-rw-r--r--tests/hwsim/test_dbus_old.py52
-rw-r--r--tests/hwsim/test_fils.py2
-rw-r--r--tests/hwsim/test_fst_config.py4
-rw-r--r--tests/hwsim/test_fst_module.py46
-rw-r--r--tests/hwsim/test_hostapd_oom.py4
-rw-r--r--tests/hwsim/test_ibss.py8
-rw-r--r--tests/hwsim/test_macsec.py2
-rw-r--r--tests/hwsim/test_mbo.py2
-rw-r--r--tests/hwsim/test_ocv.py8
-rw-r--r--tests/hwsim/test_p2p_channel.py2
-rw-r--r--tests/hwsim/test_rfkill.py2
-rw-r--r--tests/hwsim/test_rrm.py6
-rw-r--r--tests/hwsim/test_wext.py2
-rw-r--r--tests/hwsim/test_wmediumd.py4
-rw-r--r--tests/hwsim/test_wnm.py4
-rw-r--r--tests/hwsim/test_wpas_ctrl.py8
-rw-r--r--tests/hwsim/test_wpas_mesh.py6
-rw-r--r--tests/hwsim/test_wpas_wmm_ac.py14
-rw-r--r--tests/hwsim/tshark.py6
-rw-r--r--tests/hwsim/wlantest.py2
-rw-r--r--tests/hwsim/wpasupplicant.py4
-rwxr-xr-xtests/remote/run-tests.py12
-rwxr-xr-xwpa_supplicant/examples/dpp-qrcode.py4
-rwxr-xr-xwpa_supplicant/examples/p2p-nfc.py28
-rw-r--r--wpa_supplicant/examples/p2p/p2p_connect.py4
-rw-r--r--wpa_supplicant/examples/p2p/p2p_disconnect.py2
-rw-r--r--wpa_supplicant/examples/p2p/p2p_find.py2
-rw-r--r--wpa_supplicant/examples/p2p/p2p_flush.py2
-rw-r--r--wpa_supplicant/examples/p2p/p2p_group_add.py2
-rw-r--r--wpa_supplicant/examples/p2p/p2p_invite.py2
-rw-r--r--wpa_supplicant/examples/p2p/p2p_listen.py2
-rw-r--r--wpa_supplicant/examples/p2p/p2p_stop_find.py2
-rwxr-xr-xwpa_supplicant/examples/wpas-dbus-new.py4
-rwxr-xr-xwpa_supplicant/examples/wpas-test.py4
-rwxr-xr-xwpa_supplicant/examples/wps-nfc.py20
-rwxr-xr-xwpaspy/test.py4
55 files changed, 331 insertions, 331 deletions
diff --git a/hostapd/wps-ap-nfc.py b/hostapd/wps-ap-nfc.py
index 2fc3012..9e24d60 100755
--- a/hostapd/wps-ap-nfc.py
+++ b/hostapd/wps-ap-nfc.py
@@ -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
diff --git a/tests/hwsim/fst_module_aux.py b/tests/hwsim/fst_module_aux.py
index 9fd838f..d929134 100644
--- a/tests/hwsim/fst_module_aux.py
+++ b/tests/hwsim/fst_module_aux.py
@@ -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
diff --git a/tests/hwsim/hwsim.py b/tests/hwsim/hwsim.py
index e21c814..23bfe32 100644
--- a/tests/hwsim/hwsim.py
+++ b/tests/hwsim/hwsim.py
@@ -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
diff --git a/tests/hwsim/hwsim_utils.py b/tests/hwsim/hwsim_utils.py
index 718d53f..8ad08fc 100644
--- a/tests/hwsim/hwsim_utils.py
+++ b/tests/hwsim/hwsim_utils.py
@@ -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)
diff --git a/tests/hwsim/p2p_utils.py b/tests/hwsim/p2p_utils.py
index f728652..1a4646d 100644
--- a/tests/hwsim/p2p_utils.py
+++ b/tests/hwsim/p2p_utils.py
@@ -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)
diff --git a/tests/hwsim/run-tests.py b/tests/hwsim/run-tests.py
index 4f5fb4e..1649f3f 100755
--- a/tests/hwsim/run-tests.py
+++ b/tests/hwsim/run-tests.py
@@ -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
diff --git a/tests/hwsim/test_ap_ciphers.py b/tests/hwsim/test_ap_ciphers.py
index abed26f..8e5b2d6 100644
--- a/tests/hwsim/test_ap_ciphers.py
+++ b/tests/hwsim/test_ap_ciphers.py
@@ -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
diff --git a/tests/hwsim/test_ap_dynamic.py b/tests/hwsim/test_ap_dynamic.py
index 2fef021..9b6ba11 100644
--- a/tests/hwsim/test_ap_dynamic.py
+++ b/tests/hwsim/test_ap_dynamic.py
@@ -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:
diff --git a/tests/hwsim/test_ap_eap.py b/tests/hwsim/test_ap_eap.py
index 0fa64e2..4d7fcb9 100644
--- a/tests/hwsim/test_ap_eap.py
+++ b/tests/hwsim/test_ap_eap.py
@@ -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)):
diff --git a/tests/hwsim/test_ap_ft.py b/tests/hwsim/test_ap_ft.py
index 6ab4f8c..2de21d4 100644
--- a/tests/hwsim/test_ap_ft.py
+++ b/tests/hwsim/test_ap_ft.py
@@ -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
diff --git a/tests/hwsim/test_ap_hs20.py b/tests/hwsim/test_ap_hs20.py
index 99a01a9..ec5ac02 100644
--- a/tests/hwsim/test_ap_hs20.py
+++ b/tests/hwsim/test_ap_hs20.py
@@ -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")
diff --git a/tests/hwsim/test_ap_open.py b/tests/hwsim/test_ap_open.py
index de7c6d4..3907925 100644
--- a/tests/hwsim/test_ap_open.py
+++ b/tests/hwsim/test_ap_open.py
@@ -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:
diff --git a/tests/hwsim/test_ap_params.py b/tests/hwsim/test_ap_params.py
index a39bfce..16da15a 100644
--- a/tests/hwsim/test_ap_params.py
+++ b/tests/hwsim/test_ap_params.py
@@ -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:
diff --git a/tests/hwsim/test_ap_pmf.py b/tests/hwsim/test_ap_pmf.py
index e2f6529..071f9e6 100644
--- a/tests/hwsim/test_ap_pmf.py
+++ b/tests/hwsim/test_ap_pmf.py
@@ -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'])
diff --git a/tests/hwsim/test_ap_tdls.py b/tests/hwsim/test_ap_tdls.py
index 2d1fc2c..bba2bac 100644
--- a/tests/hwsim/test_ap_tdls.py
+++ b/tests/hwsim/test_ap_tdls.py
@@ -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")
diff --git a/tests/hwsim/test_ap_vht.py b/tests/hwsim/test_ap_vht.py
index 1e15839..d1fc0e8 100644
--- a/tests/hwsim/test_ap_vht.py
+++ b/tests/hwsim/test_ap_vht.py
@@ -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")
diff --git a/tests/hwsim/test_ap_vlan.py b/tests/hwsim/test_ap_vlan.py
index 62e1d32..bde4338 100644
--- a/tests/hwsim/test_ap_vlan.py
+++ b/tests/hwsim/test_ap_vlan.py
@@ -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")
diff --git a/tests/hwsim/test_ap_wps.py b/tests/hwsim/test_ap_wps.py
index b8fcfb3..ad72faf 100644
--- a/tests/hwsim/test_ap_wps.py
+++ b/tests/hwsim/test_ap_wps.py
@@ -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)
diff --git a/tests/hwsim/test_dbus.py b/tests/hwsim/test_dbus.py
index 3baca4c..e0703fa 100644
--- a/tests/hwsim/test_dbus.py
+++ b/tests/hwsim/test_dbus.py
@@ -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))
diff --git a/tests/hwsim/test_dbus_old.py b/tests/hwsim/test_dbus_old.py
index 9034fdd..bb6043e 100644
--- a/tests/hwsim/test_dbus_old.py
+++ b/tests/hwsim/test_dbus_old.py
@@ -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))
diff --git a/tests/hwsim/test_fils.py b/tests/hwsim/test_fils.py
index 7d8b5f4..f4c5af2 100644
--- a/tests/hwsim/test_fils.py
+++ b/tests/hwsim/test_fils.py
@@ -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
diff --git a/tests/hwsim/test_fst_config.py b/tests/hwsim/test_fst_config.py
index 9244740..0c0107c 100644
--- a/tests/hwsim/test_fst_config.py
+++ b/tests/hwsim/test_fst_config.py
@@ -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)))
diff --git a/tests/hwsim/test_fst_module.py b/tests/hwsim/test_fst_module.py
index 4e182b9..7e7f096 100644
--- a/tests/hwsim/test_fst_module.py
+++ b/tests/hwsim/test_fst_module.py
@@ -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
diff --git a/tests/hwsim/test_hostapd_oom.py b/tests/hwsim/test_hostapd_oom.py
index ed64fd1..f0010e4 100644
--- a/tests/hwsim/test_hostapd_oom.py
+++ b/tests/hwsim/test_hostapd_oom.py
@@ -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:
diff --git a/tests/hwsim/test_ibss.py b/tests/hwsim/test_ibss.py
index 2c58b22..a9935df 100644
--- a/tests/hwsim/test_ibss.py
+++ b/tests/hwsim/test_ibss.py
@@ -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):
diff --git a/tests/hwsim/test_macsec.py b/tests/hwsim/test_macsec.py
index 1b36e9f..8de4bf0 100644
--- a/tests/hwsim/test_macsec.py
+++ b/tests/hwsim/test_macsec.py
@@ -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
diff --git a/tests/hwsim/test_mbo.py b/tests/hwsim/test_mbo.py
index 3eb0f51..a36aee2 100644
--- a/tests/hwsim/test_mbo.py
+++ b/tests/hwsim/test_mbo.py
@@ -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:
diff --git a/tests/hwsim/test_ocv.py b/tests/hwsim/test_ocv.py
index b76b6cf..49fb8f0 100644
--- a/tests/hwsim/test_ocv.py
+++ b/tests/hwsim/test_ocv.py
@@ -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
diff --git a/tests/hwsim/test_p2p_channel.py b/tests/hwsim/test_p2p_channel.py
index bab3cc5..3683735 100644
--- a/tests/hwsim/test_p2p_channel.py
+++ b/tests/hwsim/test_p2p_channel.py
@@ -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")
diff --git a/tests/hwsim/test_rfkill.py b/tests/hwsim/test_rfkill.py
index d137531..8a2a5e2 100644
--- a/tests/hwsim/test_rfkill.py
+++ b/tests/hwsim/test_rfkill.py
@@ -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")
diff --git a/tests/hwsim/test_rrm.py b/tests/hwsim/test_rrm.py
index 343a4e3..e498672 100644
--- a/tests/hwsim/test_rrm.py
+++ b/tests/hwsim/test_rrm.py
@@ -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
diff --git a/tests/hwsim/test_wext.py b/tests/hwsim/test_wext.py
index 9c1c0c8..2bf3451 100644
--- a/tests/hwsim/test_wext.py
+++ b/tests/hwsim/test_wext.py
@@ -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
diff --git a/tests/hwsim/test_wmediumd.py b/tests/hwsim/test_wmediumd.py
index d07d5ac..26a7521 100644
--- a/tests/hwsim/test_wmediumd.py
+++ b/tests/hwsim/test_wmediumd.py
@@ -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
diff --git a/tests/hwsim/test_wnm.py b/tests/hwsim/test_wnm.py
index 2f8a250..1927616 100644
--- a/tests/hwsim/test_wnm.py
+++ b/tests/hwsim/test_wnm.py
@@ -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
diff --git a/tests/hwsim/test_wpas_ctrl.py b/tests/hwsim/test_wpas_ctrl.py
index f8b501a..d1b9763 100644
--- a/tests/hwsim/test_wpas_ctrl.py
+++ b/tests/hwsim/test_wpas_ctrl.py
@@ -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
diff --git a/tests/hwsim/test_wpas_mesh.py b/tests/hwsim/test_wpas_mesh.py
index c20d5da..45317d0 100644
--- a/tests/hwsim/test_wpas_mesh.py
+++ b/tests/hwsim/test_wpas_mesh.py
@@ -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)
diff --git a/tests/hwsim/test_wpas_wmm_ac.py b/tests/hwsim/test_wpas_wmm_ac.py
index 149dd72..f81588a 100644
--- a/tests/hwsim/test_wpas_wmm_ac.py
+++ b/tests/hwsim/test_wpas_wmm_ac.py
@@ -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
diff --git a/tests/hwsim/tshark.py b/tests/hwsim/tshark.py
index b90f662..81aee6c 100644
--- a/tests/hwsim/tshark.py
+++ b/tests/hwsim/tshark.py
@@ -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()
diff --git a/tests/hwsim/wlantest.py b/tests/hwsim/wlantest.py
index 10bb45f..75dcdb5 100644
--- a/tests/hwsim/wlantest.py
+++ b/tests/hwsim/wlantest.py
@@ -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
diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py
index 1698fca..5b57b76 100644
--- a/tests/hwsim/wpasupplicant.py
+++ b/tests/hwsim/wpasupplicant.py
@@ -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
diff --git a/tests/remote/run-tests.py b/tests/remote/run-tests.py
index b438815..5ea2bd1 100755
--- a/tests/remote/run-tests.py
+++ b/tests/remote/run-tests.py
@@ -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())
diff --git a/wpa_supplicant/examples/dpp-qrcode.py b/wpa_supplicant/examples/dpp-qrcode.py
index e2a00c9..f40f961 100755
--- a/wpa_supplicant/examples/dpp-qrcode.py
+++ b/wpa_supplicant/examples/dpp-qrcode.py
@@ -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
diff --git a/wpa_supplicant/examples/p2p-nfc.py b/wpa_supplicant/examples/p2p-nfc.py
index 91eba28..646f452 100755
--- a/wpa_supplicant/examples/p2p-nfc.py
+++ b/wpa_supplicant/examples/p2p-nfc.py
@@ -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
diff --git a/wpa_supplicant/examples/p2p/p2p_connect.py b/wpa_supplicant/examples/p2p/p2p_connect.py
index 59b0a9d..cb12081 100644
--- a/wpa_supplicant/examples/p2p/p2p_connect.py
+++ b/wpa_supplicant/examples/p2p/p2p_connect.py
@@ -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 \
diff --git a/wpa_supplicant/examples/p2p/p2p_disconnect.py b/wpa_supplicant/examples/p2p/p2p_disconnect.py
index c3e39b3..9ea2c5c 100644
--- a/wpa_supplicant/examples/p2p/p2p_disconnect.py
+++ b/wpa_supplicant/examples/p2p/p2p_disconnect.py
@@ -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
diff --git a/wpa_supplicant/examples/p2p/p2p_find.py b/wpa_supplicant/examples/p2p/p2p_find.py
index 973d46a..9c860d1 100644
--- a/wpa_supplicant/examples/p2p/p2p_find.py
+++ b/wpa_supplicant/examples/p2p/p2p_find.py
@@ -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
diff --git a/wpa_supplicant/examples/p2p/p2p_flush.py b/wpa_supplicant/examples/p2p/p2p_flush.py
index ff8509d..5dfe642 100644
--- a/wpa_supplicant/examples/p2p/p2p_flush.py
+++ b/wpa_supplicant/examples/p2p/p2p_flush.py
@@ -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
diff --git a/wpa_supplicant/examples/p2p/p2p_group_add.py b/wpa_supplicant/examples/p2p/p2p_group_add.py
index 5c8fdaf..4e64892 100644
--- a/wpa_supplicant/examples/p2p/p2p_group_add.py
+++ b/wpa_supplicant/examples/p2p/p2p_group_add.py
@@ -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
diff --git a/wpa_supplicant/examples/p2p/p2p_invite.py b/wpa_supplicant/examples/p2p/p2p_invite.py
index 6deb397..9413f02 100644
--- a/wpa_supplicant/examples/p2p/p2p_invite.py
+++ b/wpa_supplicant/examples/p2p/p2p_invite.py
@@ -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
diff --git a/wpa_supplicant/examples/p2p/p2p_listen.py b/wpa_supplicant/examples/p2p/p2p_listen.py
index bb3c1e4..1dd61f6 100644
--- a/wpa_supplicant/examples/p2p/p2p_listen.py
+++ b/wpa_supplicant/examples/p2p/p2p_listen.py
@@ -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
diff --git a/wpa_supplicant/examples/p2p/p2p_stop_find.py b/wpa_supplicant/examples/p2p/p2p_stop_find.py
index f6c03b0..31b54dd 100644
--- a/wpa_supplicant/examples/p2p/p2p_stop_find.py
+++ b/wpa_supplicant/examples/p2p/p2p_stop_find.py
@@ -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
diff --git a/wpa_supplicant/examples/wpas-dbus-new.py b/wpa_supplicant/examples/wpas-dbus-new.py
index 25072ce..885262c 100755
--- a/wpa_supplicant/examples/wpas-dbus-new.py
+++ b/wpa_supplicant/examples/wpas-dbus-new.py
@@ -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
diff --git a/wpa_supplicant/examples/wpas-test.py b/wpa_supplicant/examples/wpas-test.py
index fd7f73d..31713ca 100755
--- a/wpa_supplicant/examples/wpas-test.py
+++ b/wpa_supplicant/examples/wpas-test.py
@@ -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
diff --git a/wpa_supplicant/examples/wps-nfc.py b/wpa_supplicant/examples/wps-nfc.py
index 7459eb9..2e68693 100755
--- a/wpa_supplicant/examples/wps-nfc.py
+++ b/wpa_supplicant/examples/wps-nfc.py
@@ -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
diff --git a/wpaspy/test.py b/wpaspy/test.py
index 9141a8d..cdfa71b 100755
--- a/wpaspy/test.py
+++ b/wpaspy/test.py
@@ -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