New submission from Paul Wiseman:

I was using py2.7.3 and was getting None back for the errno attribute for an 
ssl.SSLError('The read operation timed out').

I noticed in the 2.7.4 release notes that it sounds like there was a fix for 
this:

Issue #12065: connect_ex() on an SSL socket now returns the original errno
when the socket's timeout expires (it used to return None).

I've just tested in py2.7.4 and I'm still getting None back for the errno 
attribute.

I'm using this code to produce the error:

import requests

def __init__(self, exception):
    # First extract the real underlying exception
    exception = exception.args[0]  # This should be ssl.SSLError
    super(requests.exceptions.ConnectionError, self).__init__(exception)
    self.strerror = exception.strerror
    self.errno = exception.errno

requests.exceptions.ConnectionError.__init__ = __init__

timeout_val = 0.2
while True:
    try:
        print requests.get("https://google.com";, timeout=timeout_val)
    except requests.exceptions.SSLError as err:
        print err.strerror
        print err.errno
        break
    except Exception as err:
        print "Got %s: %s" % (err.__class__.__name__, err)
    timeout_val /= 2

----------
messages: 186310
nosy: Paul.Wiseman
priority: normal
severity: normal
status: open
title: ssl.SSLError has errno value of None
type: behavior
versions: Python 2.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue17664>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to