Python 2.7 urllib.urlretrieve unknown url type https

743 views Asked by At

I previously ran into this error and after fixing it, I ran into this:

I/python  ( 7569):  Traceback (most recent call last):
I/python  ( 7569):    File "/home/cristi/Desktop/AplicatieMinister/.buildozer/android/app/main.py", line 102, in <module>
I/python  ( 7569):    File "/home/cristi/Desktop/AplicatieMinister/.buildozer/android/app/main.py", line 63, in IncarcaAfise
I/python  ( 7569):    File "/home/cristi/Desktop/AplicatieMinister/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/urllib.py", line 91, in urlretrieve
I/python  ( 7569):    File "/home/cristi/Desktop/AplicatieMinister/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/urllib.py", line 237, in retrieve
I/python  ( 7569):    File "/home/cristi/Desktop/AplicatieMinister/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/urllib.py", line 205, in open
I/python  ( 7569):    File "/home/cristi/Desktop/AplicatieMinister/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/urllib.py", line 356, in open_http
I/python  ( 7569):    File "/home/cristi/Desktop/AplicatieMinister/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/urllib.py", line 369, in http_error
I/python  ( 7569):    File "/home/cristi/Desktop/AplicatieMinister/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/urllib.py", line 632, in http_error_302
I/python  ( 7569):    File "/home/cristi/Desktop/AplicatieMinister/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/urllib.py", line 659, in redirect_internal
I/python  ( 7569):    File "/home/cristi/Desktop/AplicatieMinister/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/urllib.py", line 202, in open
I/python  ( 7569):    File "/home/cristi/Desktop/AplicatieMinister/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/urllib.py", line 214, in open_unknown
I/python  ( 7569):  IOError: [Errno url error] unknown url type: 'https'

The following (relevant) code was used:

import urllib
urllib.urlretrieve('https://dl.dropboxusercontent.com/u/95587456/Evenimente/1.jpg','/storage/emulated/0/Temp/1.jpg')

I tried replacing the 'https' with http, but it ran into the same error. Now, after looking a while on the internet, on forums and whatnot, I saw that people have recompiled Python with SSL support. However, I failed to find a guide that would explain how that is done. Also, if I am to recompile python, am I going to lose the libraries installed so far?

The operating system used is Ubuntu 14.04, with Python 2.7, and the application was compiled by buildozer (using Kivy) and ran on Android (from an APK). The APK has its internet permission set to true.

1

There are 1 answers

0
Sam Sk On

Try adding 'openssl' to your buildozer or p4a requirements. – inclement

Worked for me too. was stuck for long. Adding this above comment as an answer so other newbie like me can find it easily