编程语言
首页 > 编程语言> > python – Httplib2 – AttributeError:’NoneType’对象没有属性’makefile’

python – Httplib2 – AttributeError:’NoneType’对象没有属性’makefile’

作者:互联网

我该如何解决?
PS:在谷歌搜索,我发现这是一些httplib2错误,但我不明白如何使用人们提供的补丁.

Traceback (most recent call last):  
  File "alt_func.py", line 18, in <module>  
    func(code)
  File "alt_func.py", line 9, in func
    resp, content = h.request(url_string, "GET", headers={'Referer': referer})  
  File "/usr/lib/pymodules/python2.6/httplib2/__init__.py", line 1099, in request  
    (response, new_content) = self._request(conn, authority, uri, request_uri, method,     body, headers, redirections, cachekey)  
  File "/usr/lib/pymodules/python2.6/httplib2/__init__.py", line 901, in _request
    (response, content) = self._conn_request(conn, request_uri, method, body, headers)  
  File "/usr/lib/pymodules/python2.6/httplib2/__init__.py", line 871, in _conn_request  
    response = conn.getresponse()  
  File "/usr/lib/python2.6/httplib.py", line 984, in getresponse  
    method=self._method)  
  File "/usr/lib/python2.6/httplib.py", line 330, in __init__  
    self.fp = sock.makefile('rb', 0)  
AttributeError: 'NoneType' object has no attribute 'makefile'  

解决方法:

这是一个已知问题:http://code.google.com/p/httplib2/issues/detail?id=96

似乎记录了一些欺骗,或者可能由不同情况引起的相同症状:

> http://code.google.com/p/httplib2/issues/detail?id=101
> http://code.google.com/p/httplib2/issues/detail?id=102

标签:python,httplib2
来源: https://codeday.me/bug/20190722/1497840.html