summaryrefslogtreecommitdiff
path: root/dbus
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2011-12-13 11:55:44 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2011-12-13 11:55:44 +0000
commit14225c74b5bd75cf6c4cda3647341dc20214e6b8 (patch)
tree681f90d0f96ac02d393a74f9312de33d1c6f7cb3 /dbus
parent959ce518a3b5b8794b9813bac82c64540c21fc31 (diff)
downloaddbus-python-14225c74b5bd75cf6c4cda3647341dc20214e6b8.tar.gz
Use Python 3 syntax to catch exceptions
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Diffstat (limited to 'dbus')
-rw-r--r--dbus/_expat_introspect_parser.py2
-rw-r--r--dbus/bus.py2
-rw-r--r--dbus/connection.py6
-rw-r--r--dbus/proxies.py2
-rw-r--r--dbus/service.py6
5 files changed, 9 insertions, 9 deletions
diff --git a/dbus/_expat_introspect_parser.py b/dbus/_expat_introspect_parser.py
index 96b27ad..de38c45 100644
--- a/dbus/_expat_introspect_parser.py
+++ b/dbus/_expat_introspect_parser.py
@@ -81,5 +81,5 @@ def process_introspection_data(data):
"""
try:
return _Parser().parse(data)
- except Exception, e:
+ except Exception as e:
raise IntrospectionParserException('%s: %s' % (e.__class__, e))
diff --git a/dbus/bus.py b/dbus/bus.py
index 86c655d..6f775de 100644
--- a/dbus/bus.py
+++ b/dbus/bus.py
@@ -176,7 +176,7 @@ class BusConnection(Connection):
and bus_name != BUS_DAEMON_NAME):
try:
return self.get_name_owner(bus_name)
- except DBusException, e:
+ except DBusException as e:
if e.get_dbus_name() != _NAME_HAS_NO_OWNER:
raise
# else it doesn't exist: try to start it
diff --git a/dbus/connection.py b/dbus/connection.py
index d76aaf2..10f03c7 100644
--- a/dbus/connection.py
+++ b/dbus/connection.py
@@ -525,7 +525,7 @@ class Connection(_Connection):
for cb in self.__call_on_disconnection:
try:
cb(self)
- except Exception, e:
+ except Exception as e:
# basicConfig is a no-op if logging is already configured
logging.basicConfig()
_logger.error('Exception in handler for Disconnected '
@@ -564,7 +564,7 @@ class Connection(_Connection):
# Add the arguments to the function
try:
message.append(signature=signature, *args)
- except Exception, e:
+ except Exception as e:
logging.basicConfig()
_logger.error('Unable to set arguments %r according to '
'signature %r: %s: %s',
@@ -618,7 +618,7 @@ class Connection(_Connection):
# Add the arguments to the function
try:
message.append(signature=signature, *args)
- except Exception, e:
+ except Exception as e:
logging.basicConfig()
_logger.error('Unable to set arguments %r according to '
'signature %r: %s: %s',
diff --git a/dbus/proxies.py b/dbus/proxies.py
index bf99a1c..51d8d9f 100644
--- a/dbus/proxies.py
+++ b/dbus/proxies.py
@@ -388,7 +388,7 @@ class ProxyObject(object):
try:
try:
self._introspect_method_map = process_introspection_data(data)
- except IntrospectionParserException, e:
+ except IntrospectionParserException as e:
self._introspect_error_handler(e)
return
diff --git a/dbus/service.py b/dbus/service.py
index b92d840..f1b3a9b 100644
--- a/dbus/service.py
+++ b/dbus/service.py
@@ -250,12 +250,12 @@ def _method_reply_return(connection, message, method_name, signature, *retval):
reply = MethodReturnMessage(message)
try:
reply.append(signature=signature, *retval)
- except Exception, e:
+ except Exception as e:
logging.basicConfig()
if signature is None:
try:
signature = reply.guess_signature(retval) + ' (guessed)'
- except Exception, e:
+ except Exception as e:
_logger.error('Unable to guess signature for arguments %r: '
'%s: %s', retval, e.__class__, e)
raise
@@ -743,7 +743,7 @@ class Object(Interface):
retval = (retval,)
_method_reply_return(connection, message, method_name, signature, *retval)
- except Exception, exception:
+ except Exception as exception:
# send error reply
_method_reply_error(connection, message, exception)