title: Trouble retrying on interrupted system call
body: <p>I have recently run into an issue at work where we are having intermittent problems with an internal website not loading due to an interrupted system call. We are using urllib2 to access the website. I can't share the exact code, but here is basically how we do it:</p>
  
  <pre><code>payload = {'userName': user_name,
             'emailAddress': email_address,
             'password': password}
  headers = {'Accept': 'application/json',
             'Content-Type': 'application/json',
             'Authorization': token}
  values = json.dumps(payload)
  req = urllib2.Request(url, values, headers)
  
  try:
      response = urllib2.urlopen(req, timeout=30)
      break
  except IOError, e:
      if e.errno != errno.EINTR:
          print e.errno
      raise
  </code></pre>
  
  <p>We log the errono and the raised exception. The exception is:</p>
  
  <pre><code>IOError: &lt;urlopen error [Errno 4] Interrupted system call&gt;
  </code></pre>
  
  <p>And the errno is <code>None</code>. I expected it to be 4.</p>
  
  <p>Is there a better way to catch this error in Python 2.7? I am aware of PEP475, but we cannot upgrade to Python 3 right now.</p>