From 81b53633aa7a2a721495ce84c8699c6c18ffcca0 Mon Sep 17 00:00:00 2001 From: pentusha Date: Sun, 26 May 2013 19:51:14 +0700 Subject: [PATCH] python 3 exceptions compatibility --- gearman/connection.py | 6 +++--- gearman/util.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gearman/connection.py b/gearman/connection.py index e8bfa73..1cfb07a 100644 --- a/gearman/connection.py +++ b/gearman/connection.py @@ -97,7 +97,7 @@ def _create_client_socket(self): try: client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) client_socket.connect((self.gearman_host, self.gearman_port)) - except socket.error, socket_exception: + except socket.error as socket_exception: self.throw_exception(exception=socket_exception) self.set_socket(client_socket) @@ -144,7 +144,7 @@ def read_data_from_socket(self, bytes_to_read=4096): recv_buffer = '' try: recv_buffer = self.gearman_socket.recv(bytes_to_read) - except socket.error, socket_exception: + except socket.error as socket_exception: self.throw_exception(exception=socket_exception) if len(recv_buffer) == 0: @@ -203,7 +203,7 @@ def send_data_to_socket(self): try: bytes_sent = self.gearman_socket.send(self._outgoing_buffer) - except socket.error, socket_exception: + except socket.error as socket_exception: self.throw_exception(exception=socket_exception) if bytes_sent == 0: diff --git a/gearman/util.py b/gearman/util.py index 0674326..e780dd7 100644 --- a/gearman/util.py +++ b/gearman/util.py @@ -59,7 +59,7 @@ def select(rlist, wlist, xlist, timeout=None): try: rd_list, wr_list, ex_list = select_lib.select(*select_args) - except select_lib.error, exc: + except select_lib.error as exc: # Ignore interrupted system call, reraise anything else if exc[0] != errno.EINTR: raise