mamaduckmaster / httplib2

Automatically exported from code.google.com/p/httplib2
0 stars 0 forks source link

Attempting to contacting a down sever results in AttributeError #152

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Open a connection to a server that is not listening or doesn't exist.
2. A non-specific error is thrown: AttributeError: 'NoneType' object has no 
attribute 'makefile'

What is the expected output? What do you see instead?

This should raise a useful/contextual exception. This should be fixed per 
http://code.google.com/p/httplib2/issues/detail?id=62, however it was marked 
fixed and people still have it.

See the stack trace pasted below.

What version of the product are you using? On what operating system?

0.6.0, python 2.7.1 on Mac OS X, 64bit.

Please provide any additional information below.

/Users/user/dev/nipra/eggs/httplib2-0.6.0-py2.7.egg/httplib2/__init__.pyc in 
request(self, uri, method, body, headers, redirections, connection_type)
   1127                     content = ""
   1128                 else:
-> 1129                     (response, content) = self._request(conn, 
authority, uri, request_uri, method, body, headers, redirections, cachekey)
   1130         except Exception, e:
   1131             if self.force_exception_to_status_code:

/Users/user/dev/nipra/eggs/httplib2-0.6.0-py2.7.egg/httplib2/__init__.pyc in 
_request(self, conn, host, absolute_uri, request_uri, method, body, headers, 
redirections, cachekey)
    899             auth.request(method, request_uri, headers, body)
    900 
--> 901         (response, content) = self._conn_request(conn, request_uri, 
method, body, headers)
    902 
    903         if auth:

/Users/user/dev/nipra/eggs/httplib2-0.6.0-py2.7.egg/httplib2/__init__.pyc in 
_conn_request(self, conn, request_uri, method, body, headers)
    869                 pass
    870             try:
--> 871                 response = conn.getresponse()
    872             except (socket.error, httplib.HTTPException):
    873                 if i == 0:

/usr/local/Cellar/python/2.7.1/lib/python2.7/httplib.pyc in getresponse(self, 
buffering)
   1009             #other response_classes.

   1010             kwds["buffering"] = True;
-> 1011         response = self.response_class(*args, **kwds)
   1012 
   1013         response.begin()

/usr/local/Cellar/python/2.7.1/lib/python2.7/httplib.pyc in __init__(self, 
sock, debuglevel, strict, method, buffering)
    339             # response, which make be read via a recv() on the underlying

    340             # socket.

--> 341             self.fp = sock.makefile('rb', 0)
    342         self.debuglevel = debuglevel
    343         self.strict = strict

AttributeError: 'NoneType' object has no attribute 'makefile'

Original issue reported on code.google.com by nino.wal...@gmail.com on 7 Jun 2011 at 11:54

GoogleCodeExporter commented 8 years ago
This appears to be a duplicate...

Original comment by nino.wal...@gmail.com on 7 Jun 2011 at 11:55

GoogleCodeExporter commented 8 years ago

Original comment by joe.gregorio@gmail.com on 13 Jun 2011 at 4:59