aboutsummaryrefslogtreecommitdiff
path: root/tools/EventClients
diff options
context:
space:
mode:
authorRechi <Rechi@users.noreply.github.com>2017-11-23 09:11:02 +0100
committerRechi <Rechi@users.noreply.github.com>2017-11-23 09:11:02 +0100
commite6ad8c9d98801ea276d7a3dced6383200701cc58 (patch)
tree5d89ff70f04275462f8174b10b253730376e98cc /tools/EventClients
parent0a70fe9893dac8654c648f87272e7588297bc71d (diff)
[EventClients][python] except syntax change
Diffstat (limited to 'tools/EventClients')
-rwxr-xr-xtools/EventClients/Clients/Kodi Send/kodi-send.py2
-rwxr-xr-xtools/EventClients/Clients/PS3 BD Remote/ps3_remote.py6
-rwxr-xr-xtools/EventClients/Clients/PS3 Sixaxis Controller/ps3d.py24
-rwxr-xr-xtools/EventClients/examples/python/example_action.py2
-rw-r--r--tools/EventClients/lib/python/bt/hid.py2
-rwxr-xr-xtools/EventClients/lib/python/ps3/sixwatch.py2
-rw-r--r--tools/EventClients/lib/python/zeroconf.py2
7 files changed, 20 insertions, 20 deletions
diff --git a/tools/EventClients/Clients/Kodi Send/kodi-send.py b/tools/EventClients/Clients/Kodi Send/kodi-send.py
index 4d97646105..c114a22b3b 100755
--- a/tools/EventClients/Clients/Kodi Send/kodi-send.py
+++ b/tools/EventClients/Clients/Kodi Send/kodi-send.py
@@ -42,7 +42,7 @@ def usage():
def main():
try:
opts, args = getopt.getopt(sys.argv[1:], "?pa:v", ["help", "host=", "port=", "action="])
- except getopt.GetoptError, err:
+ except getopt.GetoptError as err:
# print help information and exit:
print(str(err)) # will print something like "option -a not recognized"
usage()
diff --git a/tools/EventClients/Clients/PS3 BD Remote/ps3_remote.py b/tools/EventClients/Clients/PS3 BD Remote/ps3_remote.py
index a9f57ccb5a..e902bb8519 100755
--- a/tools/EventClients/Clients/PS3 BD Remote/ps3_remote.py
+++ b/tools/EventClients/Clients/PS3 BD Remote/ps3_remote.py
@@ -69,7 +69,7 @@ def get_remote_address(remote, target_name = "BD Remote Control"):
if not target_address:
try:
nearby_devices = bt_discover_devices()
- except Exception, e:
+ except Exception as e:
print("Error performing bluetooth discovery")
print(str(e))
xbmc.send_notification("Error", "Unable to find devices.", bticon)
@@ -150,7 +150,7 @@ def process_keys(remote, xbmc):
try:
data = remote.recv(1024)
datalen = len(data)
- except Exception, e:
+ except Exception as e:
if str(e)=="timed out":
return 2
time.sleep(2)
@@ -178,7 +178,7 @@ def process_keys(remote, xbmc):
if g_keymap[keycode]:
xbmc.send_remote_button(g_keymap[keycode])
- except Exception, e:
+ except Exception as e:
print("Unknown data: %s" % str(e))
return done
diff --git a/tools/EventClients/Clients/PS3 Sixaxis Controller/ps3d.py b/tools/EventClients/Clients/PS3 Sixaxis Controller/ps3d.py
index d83ab3447e..defc6494a5 100755
--- a/tools/EventClients/Clients/PS3 Sixaxis Controller/ps3d.py
+++ b/tools/EventClients/Clients/PS3 Sixaxis Controller/ps3d.py
@@ -34,7 +34,7 @@ if os.path.exists("../../lib/python"):
from ps3_remote import process_keys as process_remote
try:
from ps3 import sixwatch
- except Exception, e:
+ except Exception as e:
print("Failed to import sixwatch now disabled: " + str(e))
sixwatch = None
@@ -53,7 +53,7 @@ else:
from kodi.defs import *
try:
from kodi.ps3 import sixwatch
- except Exception, e:
+ except Exception as e:
print("Failed to import sixwatch now disabled: " + str(e))
sixwatch = None
try:
@@ -141,11 +141,11 @@ class PS3SixaxisThread ( StoppableThread ):
try:
if six.process_socket(self.isock):
self.reset_timeout()
- except Exception, e:
+ except Exception as e:
print(e)
break
- except Exception, e:
+ except Exception as e:
printerr()
six.close()
self.close_sockets()
@@ -170,7 +170,7 @@ class PS3RemoteThread ( StoppableThread ):
self.zeroconf_thread.add_service('_xbmc-events._udp',
self.zeroconf_service_handler)
self.zeroconf_thread.start()
- except Exception, e:
+ except Exception as e:
print(str(e))
# main thread loop
@@ -191,7 +191,7 @@ class PS3RemoteThread ( StoppableThread ):
self.reset_timeout()
# process_remote() will raise an exception on read errors
- except Exception, e:
+ except Exception as e:
print(str(e))
self.zeroconf_thread.stop()
@@ -224,7 +224,7 @@ class PS3RemoteThread ( StoppableThread ):
print("Connecting to %s" % service['name'])
self.xbmc.connect( service['address'], service['port'] )
self.xbmc.send_notification("PS3 Blu-Ray Remote", "New Connection", None)
- except Exception, e:
+ except Exception as e:
print(str(e))
def zeroconf_service_handler(self, event, service):
@@ -256,7 +256,7 @@ class SixWatch(threading.Thread):
while True:
try:
sixwatch.main(self.mac)
- except Exception, e:
+ except Exception as e:
print("Exception caught in sixwatch, restarting: " + str(e))
class ZeroconfThread ( threading.Thread ):
@@ -322,7 +322,7 @@ def start_hidd(bdaddr=None, ipaddr="127.0.0.1"):
try:
print("Starting USB sixwatch")
watch = SixWatch(hid.get_local_address())
- except Exception, e:
+ except Exception as e:
print("Failed to initialize sixwatch" + str(e))
pass
@@ -375,14 +375,14 @@ def main():
raise Exception("Invalid format")
bdaddr = addr
print("Connecting to Bluetooth device: %s" % bdaddr)
- except Exception, e:
+ except Exception as e:
try:
ipaddr = addr
print("Connecting to : %s" % ipaddr)
except:
print(str(e))
return usage()
- except Exception, e:
+ except Exception as e:
pass
print("Starting HID daemon")
@@ -400,7 +400,7 @@ if __name__=="__main__":
t.join()
print("Thread "+str(t)+" terminated")
- except Exception, e:
+ except Exception as e:
print(str(e))
pass
diff --git a/tools/EventClients/examples/python/example_action.py b/tools/EventClients/examples/python/example_action.py
index 5be3ce05bb..6de0bb3825 100755
--- a/tools/EventClients/examples/python/example_action.py
+++ b/tools/EventClients/examples/python/example_action.py
@@ -25,7 +25,7 @@ def main():
except:
try:
xbmc.send_action(sys.argv[1], ACTION_EXECBUILTIN)
- except Exception, e:
+ except Exception as e:
print(str(e))
xbmc.send_action("ActivateWindow(ShutdownMenu)")
diff --git a/tools/EventClients/lib/python/bt/hid.py b/tools/EventClients/lib/python/bt/hid.py
index 7c65e100f9..c065054805 100644
--- a/tools/EventClients/lib/python/bt/hid.py
+++ b/tools/EventClients/lib/python/bt/hid.py
@@ -55,7 +55,7 @@ class HID:
print("Accepted Interrupt connection from %s" % self.iaddress[0])
self.connected = True
return True
- except Exception, e:
+ except Exception as e:
self.connected = False
return False
diff --git a/tools/EventClients/lib/python/ps3/sixwatch.py b/tools/EventClients/lib/python/ps3/sixwatch.py
index af03a83af1..f913c00cef 100755
--- a/tools/EventClients/lib/python/ps3/sixwatch.py
+++ b/tools/EventClients/lib/python/ps3/sixwatch.py
@@ -20,7 +20,7 @@ def main(mac):
print("Detected sixaxis connected by usb")
try:
sixpair.set_pair_filename(device.attributes['busnum'], device.attributes['devnum'], mac)
- except Exception, e:
+ except Exception as e:
print("Failed to check pairing of sixaxis: " + str(e))
pass
diff --git a/tools/EventClients/lib/python/zeroconf.py b/tools/EventClients/lib/python/zeroconf.py
index 5946a4e885..7f78aca1e4 100644
--- a/tools/EventClients/lib/python/zeroconf.py
+++ b/tools/EventClients/lib/python/zeroconf.py
@@ -29,7 +29,7 @@ try:
import dbus, gobject, avahi
from dbus import DBusException
from dbus.mainloop.glib import DBusGMainLoop
-except Exception, e:
+except Exception as e:
print("Zeroconf support disabled. To enable, install the following Python modules:")
print(" dbus, gobject, avahi")
pass