Hey I'm wondering how to handle specific error codes. For example,
[Errno 111] Connection refused
If you want to get the error code, this seems to do the trick;
import errno try: socketConnection() except socket.error, v: errorcode=v if errorcode==errno.ECONNREFUSED: print "Connection Refused"
You can look up
errno error codes.