Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

urllib/request fails on python2 readinto #425

Closed
hackalog opened this issue Jan 6, 2019 · 1 comment
Closed

urllib/request fails on python2 readinto #425

hackalog opened this issue Jan 6, 2019 · 1 comment

Comments

@hackalog
Copy link
Contributor

hackalog commented Jan 6, 2019

On Python 2, sockets don't have a readinto() method in the FP used in, for example, _safe_readinto.

leading to errors like that seen here: kivy/kivy-ios#322 (comment), or the below:

   File "/Users/hackalog/ios_demo/.buildozer/ios/platform/kivy-ios/toolchain.py", line 475, in download_file
     urlretrieve(url, filename, report_hook)
   File "/Users/hackalog/miniconda3/envs/ios_demo/lib/python2.7/site-packages/future/backports/urllib/request.py", line 1759, in retrieve
     block = fp.read(bs)
   File "/Users/hackalog/miniconda3/envs/ios_demo/lib/python2.7/site-packages/future/backports/http/client.py", line 516, in read
     return bytes(super(HTTPResponse, self).read(amt))
   File "/Users/hackalog/miniconda3/envs/ios_demo/lib/python2.7/site-packages/future/backports/http/client.py", line 545, in readinto
     return self._readinto_chunked(b)
   File "/Users/hackalog/miniconda3/envs/ios_demo/lib/python2.7/site-packages/future/backports/http/client.py", line 654, in _readinto_chunked
     n = self._safe_readinto(temp_mvb)
   File "/Users/hackalog/miniconda3/envs/ios_demo/lib/python2.7/site-packages/future/backports/http/client.py", line 701, in _safe_readinto
     n = self.fp.readinto(mvb)
 AttributeError: '_fileobject' object has no attribute 'readinto'

There's an if PY2 workaround for one of the readintocalls in client.py, but not these problematic ones. I propose a fix here: #423

hackalog added a commit to learnleapfly/kivy-ios that referenced this issue Jan 9, 2019
FancyUrlopener.urlretrieve was failing on redirect, but in an insidious way, because of a bug in the python-future module:
PythonCharmers/python-future#425
Replace with the requests module for the time being.
hackalog added a commit to learnleapfly/kivy-ios that referenced this issue Jan 10, 2019
FancyUrlopener.urlretrieve was failing on redirect, but in an insidious way, because of a bug in the python-future module:
PythonCharmers/python-future#425
Replace with the requests module for the time being.
hackalog added a commit to learnleapfly/kivy-ios that referenced this issue Jan 14, 2019
FancyUrlopener.urlretrieve was failing on redirect, but in an insidious way, because of a bug in the python-future module:
PythonCharmers/python-future#425
Replace with the requests module for the time being.
hackalog added a commit to learnleapfly/kivy-ios that referenced this issue Jan 19, 2019
FancyUrlopener.urlretrieve was failing on redirect, but in an insidious way, because of a bug in the python-future module:
PythonCharmers/python-future#425
Replace with the requests module for the time being.
@jmadler jmadler closed this as completed May 8, 2019
@jmadler
Copy link
Contributor

jmadler commented May 8, 2019

Resolved by #423

renabriseno68 added a commit to renabriseno68/kivy-ios-android-developer that referenced this issue Sep 13, 2022
FancyUrlopener.urlretrieve was failing on redirect, but in an insidious way, because of a bug in the python-future module:
PythonCharmers/python-future#425
Replace with the requests module for the time being.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants