From e12f520cea4a13511b94ebc1c9b90c0acca140d7 Mon Sep 17 00:00:00 2001 From: benoitc Date: Thu, 25 Oct 2012 07:14:21 +0200 Subject: [PATCH] use args for the socket errno --- gunicorn/sock.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gunicorn/sock.py b/gunicorn/sock.py index 11dcd75e..6f1f6d7e 100644 --- a/gunicorn/sock.py +++ b/gunicorn/sock.py @@ -118,7 +118,7 @@ def create_socket(conf, log): try: return sock_type(conf, log, fd=fd) except socket.error as e: - if e[0] == errno.ENOTCONN: + if e.args[0] == errno.ENOTCONN: log.error("GUNICORN_FD should refer to an open socket.") else: raise @@ -131,9 +131,9 @@ def create_socket(conf, log): try: return sock_type(conf, log) except socket.error as e: - if e[0] == errno.EADDRINUSE: + if e.args[0] == errno.EADDRINUSE: log.error("Connection in use: %s", str(addr)) - if e[0] == errno.EADDRNOTAVAIL: + if e.args[0] == errno.EADDRNOTAVAIL: log.error("Invalid address: %s", str(addr)) sys.exit(1) if i < 5: