diff --git a/gearman/connection.py b/gearman/connection.py index b457a18..4f6ea3a 100644 --- a/gearman/connection.py +++ b/gearman/connection.py @@ -115,7 +115,7 @@ def _create_client_socket(self): ssl_version=ssl.PROTOCOL_TLSv1) 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) @@ -172,7 +172,7 @@ def read_data_from_socket(self, bytes_to_read=4096): continue else: self.throw_exception(exception=e) - except socket.error, socket_exception: + except socket.error as socket_exception: self.throw_exception(exception=socket_exception) if len(recv_buffer) == 0: @@ -247,7 +247,7 @@ def send_data_to_socket(self): continue else: self.throw_exception(exception=e) - 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