Closed nontxt closed 5 years ago
I struggled with similar problem and used https://github.com/kivy/python-for-android/pull/1537/files to solve it. I think the problem is, that the python in your p4a is not built with ssl support, which solves abovementioned link. Just for confirmation - are you able to make http requests? Only https are not working?
@opacam Bug is aviable, checked on master branch . Checked twice: under sdk 17c sdk24 api28:
Python 3.7: module requests3
I/python (27795): Android kivy bootstrap done. __name__ is __main__
I/python (27795): AND: Ran string
I/python (27795): Run user program, change dir and execute entrypoint
I/python (27795): main.py
I/python (27795): [WARNING] [Config ] Older configuration version detected (0 instead of 20)
I/python (27795): [WARNING] [Config ] Upgrading configuration in progress.
I/python (27795): [INFO ] [Logger ] Record log in /data/data/com.example.test/files/app/.kivy/logs/kivy_19-01-10_0.txt
I/python (27795): [INFO ] [Kivy ] v1.10.1
I/python (27795): [INFO ] [Python ] v3.7.1 (default, Jan 10 2019, 08:17:38)
I/python (27795): [Clang 6.0.2 (https://android.googlesource.com/toolchain/clang 183abd29fc496f55
I/python (27795): [INFO ] [Factory ] 194 symbols loaded
I/python (27795): [INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_gif (img_pil, img_ffpyplayer ignored)
I/python (27795): [INFO ] [Window ] Provider: sdl2
I/python (27795): [INFO ] [GL ] Using the "OpenGL ES 2" graphics system
I/python (27795): [INFO ] [GL ] Backend used <gl>
I/python (27795): [INFO ] [GL ] OpenGL version <b'OpenGL ES 3.1 build 1.4@3300288'>
I/python (27795): [INFO ] [GL ] OpenGL vendor <b'Imagination Technologies'>
I/python (27795): [INFO ] [GL ] OpenGL renderer <b'PowerVR Rogue G6200'>
I/python (27795): [INFO ] [GL ] OpenGL parsed version: 3, 1
I/python (27795): [INFO ] [GL ] Texture max size <8192>
I/python (27795): [INFO ] [GL ] Texture max units <16>
I/python (27795): [INFO ] [Window ] auto add sdl2 input provider
I/python (27795): [INFO ] [Window ] virtual keyboard not allowed, single mode, not docked
I/python (27795): main.py:172: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
I/python (27795): import imp
I/python (27795): [WARNING] [Base ] Unknown <android> provider
I/python (27795): [INFO ] [Base ] Start application main loop
I/python (27795): [INFO ] [GL ] NPOT texture support is available
I/python (27795): [INFO ] [Text ] Provider: sdl2
I/python (27795): [WARNING] [Accordion ] not enough space for displaying all children
I/python (27795): [WARNING] [Accordion ] need 264px, got 0px
I/python (27795): [WARNING] [Accordion ] layout aborted.
I/python (27795): [INFO ] [Loader ] using a thread pool of 2 workers
I/python (27795): [ERROR ] [Loader ] Failed to load image <https://s-media-cache-ak0.pinimg.com/originals/75/71/45/7571452d437eac4801e6c490f5d2401e.jpg>
I/python (27795): Traceback (most recent call last):
I/python (27795): File "/data/data/com.example.test/files/app/_python_bundle/stdlib.zip/urllib/request.py", line 1317, in do_open
I/python (27795): encode_chunked=req.has_header('Transfer-encoding'))
I/python (27795): File "/data/data/com.example.test/files/app/_python_bundle/stdlib.zip/http/client.py", line 1229, in request
I/python (27795): self._send_request(method, url, body, headers, encode_chunked)
I/python (27795): File "/data/data/com.example.test/files/app/_python_bundle/stdlib.zip/http/client.py", line 1275, in _send_request
I/python (27795): self.endheaders(body, encode_chunked=encode_chunked)
I/python (27795): File "/data/data/com.example.test/files/app/_python_bundle/stdlib.zip/http/client.py", line 1224, in endheaders
I/python (27795): self._send_output(message_body, encode_chunked=encode_chunked)
I/python (27795): File "/data/data/com.example.test/files/app/_python_bundle/stdlib.zip/http/client.py", line 1016, in _send_output
I/python (27795): self.send(msg)
I/python (27795): File "/data/data/com.example.test/files/app/_python_bundle/stdlib.zip/http/client.py", line 956, in send
I/python (27795): self.connect()
I/python (27795): File "/data/data/com.example.test/files/app/_python_bundle/stdlib.zip/http/client.py", line 1392, in connect
I/python (27795): server_hostname=server_hostname)
I/python (27795): File "/data/data/com.example.test/files/app/_python_bundle/stdlib.zip/ssl.py", line 412, in wrap_socket
I/python (27795): session=session
I/python (27795): File "/data/data/com.example.test/files/app/_python_bundle/stdlib.zip/ssl.py", line 853, in _create
I/python (27795): self.do_handshake()
I/python (27795): File "/data/data/com.example.test/files/app/_python_bundle/stdlib.zip/ssl.py", line 1117, in do_handshake
I/python (27795): self._sslobj.do_handshake()
I/python (27795): ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1051)
I/python (27795): During handling of the above exception, another exception occurred:
I/python (27795): Traceback (most recent call last):
I/python (27795): File "/data/data/com.example.test/files/app/_python_bundle/site-packages/kivy/loader.py", line 317, in _load_urllib
I/python (27795): fd = urllib_request.urlopen(filename)
I/python (27795): File "/data/data/com.example.test/files/app/_python_bundle/stdlib.zip/urllib/request.py", line 222, in urlopen
I/python (27795): return opener.open(url, data, timeout)
I/python (27795): File "/data/data/com.example.test/files/app/_python_bundle/stdlib.zip/urllib/request.py", line 525, in open
I/python (27795): response = self._open(req, data)
I/python (27795): File "/data/data/com.example.test/files/app/_python_bundle/stdlib.zip/urllib/request.py", line 543, in _open
I/python (27795): '_open', req)
I/python (27795): File "/data/data/com.example.test/files/app/_python_bundle/stdlib.zip/urllib/request.py", line 503, in _call_chain
I/python (27795): result = func(*args)
I/python (27795): File "/data/data/com.example.test/files/app/_python_bundle/stdlib.zip/urllib/request.py", line 1360, in https_open
I/python (27795): context=self._context, check_hostname=self._check_hostname)
I/python (27795): File "/data/data/com.example.test/files/app/_python_bundle/stdlib.zip/urllib/request.py", line 1319, in do_open
I/python (27795): raise URLError(err)
I/python (27795): urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1051)>
Python 2.7 module requests
I/python (28963): Initializing Python for Android
I/python (28963): Changing directory to the one provided by ANDROID_ARGUMENT
I/python (28963): /data/data/com.example.test/files/app
I/python (28963): Preparing to initialize python
I/python (28963): _python_bundle dir exists
I/python (28963): calculated paths to be...
I/python (28963): /data/data/com.example.test/files/app/_python_bundle/stdlib.zip:/data/data/com.example.test/files/app/_python_bundle/modules
I/python (28963): set wchar paths...
I/python (28963): Initialized python
I/python (28963): AND: Init threads
I/python (28963): testing python print redirection
I/python (28963): ('Android path', ['.', '', '/data/data/com.example.test/files/app/_python_bundle/stdlib.zip', '/data/data/com.example.test/files/app/_python_bundle/modules', '/data/data/com.example.test/files/app/_python_bundle/site-packages'])
I/python (28963): ('os.environ is', {'ANDROID_APP_PATH': '/data/data/com.example.test/files/app', 'EXTERNAL_STORAGE': '/storage/emulated/legacy', 'LOOP_MOUNTPOINT': '/mnt/obb', 'SYSTEMSERVERCLASSPATH': '/system/framework/services.jar:/system/framework/ethernet-service.jar:/system/framework/wifi-service.jar', 'BOOTCLASSPATH': '/system/framework/core-libart.jar:/system/framework/conscrypt.jar:/system/framework/okhttp.jar:/system/framework/core-junit.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/telephony-common.jar:/system/framework/voip-common.jar:/system/framework/ims-common.jar:/system/framework/mms-common.jar:/system/framework/android.policy.jar:/system/framework/apache-xml.jar:/system/framework/mediatek-common.jar:/system/framework/mediatek-framework.jar:/system/framework/mediatek-telephony-common.jar:/system/app/miui/miui.apk:/system/app/miuisystem/miuisystem.apk', 'ANDROID_PROPERTY_WORKSPACE': '8,0', 'PATH': '/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin', 'ANDROID_STORAGE': '/storage', 'ANDROID_BOOTLOGO': '1', 'EMULATED_STORAGE_TARGET': '/storage/emulated', 'ANDROID_ASSETS': '/system/app', 'ANDROID_SOCKET_zygote_secondary': '9', 'PYTHONPATH': '/data/data/com.example.test/files/app:/data/data/com.example.test/files/app/lib', 'PYTHONOPTIMIZE': '2', 'ANDROID_PRIVATE': '/data/data/com.example.test/files', 'MC_AUTH_TOKEN_PATH': '/efs', 'USBOTG_STORAGE': '/storage/usbotg', 'ANDROID_ENTRYPOINT': 'main.pyo', 'SECONDARY_STORAGE': '/storage/sdcard1', 'ANDROID_UNPACK': '/data/data/com.example.test/files/app', 'ANDROID_DATA': '/data', 'EMULATED_STORAGE_SOURCE': '/mnt/shell/emulated', 'PYTHON_NAME': 'python', 'LD_PRELOAD': 'libsigchain.so:libudf.so', 'P4A_BOOTSTRAP': 'SDL2', 'ANDROID_ROOT': '/system', 'PYTHONHOME': '/data/data/com.example.test/files/app', 'ASEC_MOUNTPOINT': '/mnt/asec', 'ANDROID_ARGUMENT': '/data/data/com.example.test/files/app'})
I/python (28963): ('Android kivy bootstrap done. __name__ is', '__main__')
I/python (28963): ['/data/data/com.example.test/files/app/lib/python2.7/site-packages', '/data/data/com.example.test/files/app/lib/site-python']
I/python (28963): AND: Ran string
I/python (28963): Run user program, change dir and execute entrypoint
I/python (28963): main.py
I/python (28963): [WARNING] [Config ] Older configuration version detected (0 instead of 20)
I/python (28963): [WARNING] [Config ] Upgrading configuration in progress.
I/python (28963): [INFO ] [Logger ] Record log in /data/data/com.example.test/files/app/.kivy/logs/kivy_19-01-10_0.txt
I/python (28963): [INFO ] [Kivy ] v1.10.1
I/python (28963): [INFO ] [Python ] v2.7.15 (default, Jan 10 2019, 08:25:47)
I/python (28963): [GCC 4.2.1 Compatible Android (4691093 based on r316199) Clang 6.0.2 (https://a
I/python (28963): [INFO ] [Factory ] 194 symbols loaded
I/python (28963): [INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_gif (img_pil, img_ffpyplayer ignored)
I/python (28963): [INFO ] [Window ] Provider: sdl2
I/python (28963): [INFO ] [GL ] Using the "OpenGL ES 2" graphics system
I/python (28963): [INFO ] [GL ] Backend used <gl>
I/python (28963): [INFO ] [GL ] OpenGL version <OpenGL ES 3.1 build 1.4@3300288>
I/python (28963): [INFO ] [GL ] OpenGL vendor <Imagination Technologies>
I/python (28963): [INFO ] [GL ] OpenGL renderer <PowerVR Rogue G6200>
I/python (28963): [INFO ] [GL ] OpenGL parsed version: 3, 1
I/python (28963): [INFO ] [GL ] Texture max size <8192>
I/python (28963): [INFO ] [GL ] Texture max units <16>
I/python (28963): [INFO ] [Window ] auto add sdl2 input provider
I/python (28963): [INFO ] [Window ] virtual keyboard not allowed, single mode, not docked
I/python (28963): [WARNING] [Base ] Unknown <android> provider
I/python (28963): [INFO ] [Base ] Start application main loop
I/python (28963): [INFO ] [GL ] NPOT texture support is available
I/python (28963): [INFO ] [Text ] Provider: sdl2
I/python (28963): [INFO ] [Base ] Leaving application in progress...
I/python (28963): Traceback (most recent call last):
I/python (28963): File "main.py", line 193, in <module>
I/python (28963): PyConApp().run()
I/python (28963): File "/data/data/com.example.test/files/app/_python_bundle/site-packages/kivy/app.py", line 826, in run
I/python (28963): runTouchApp()
I/python (28963): File "/data/data/com.example.test/files/app/_python_bundle/site-packages/kivy/base.py", line 502, in runTouchApp
I/python (28963): EventLoop.window.mainloop()
I/python (28963): File "/data/data/com.example.test/files/app/_python_bundle/site-packages/kivy/core/window/window_sdl2.py", line 727, in mainloop
I/python (28963): self._mainloop()
I/python (28963): File "/data/data/com.example.test/files/app/_python_bundle/site-packages/kivy/core/window/window_sdl2.py", line 460, in _mainloop
I/python (28963): EventLoop.idle()
I/python (28963): File "/data/data/com.example.test/files/app/_python_bundle/site-packages/kivy/base.py", line 337, in idle
I/python (28963): Clock.tick()
I/python (28963): File "/data/data/com.example.test/files/app/_python_bundle/site-packages/kivy/clock.py", line 581, in tick
I/python (28963): self._process_events()
I/python (28963): File "kivy/_clock.pyx", line 384, in kivy._clock.CyClockBase._process_events
I/python (28963): File "kivy/_clock.pyx", line 414, in kivy._clock.CyClockBase._process_events
I/python (28963): File "kivy/_clock.pyx", line 412, in kivy._clock.CyClockBase._process_events
I/python (28963): File "kivy/_clock.pyx", line 167, in kivy._clock.ClockEvent.tick
I/python (28963): File "/data/data/com.example.test/files/app/_python_bundle/site-packages/kivy/animation.py", line 352, in _update
I/python (28963): self.stop(widget)
I/python (28963): File "/data/data/com.example.test/files/app/_python_bundle/site-packages/kivy/animation.py", line 217, in stop
I/python (28963): self.dispatch('on_complete', widget)
I/python (28963): File "kivy/_event.pyx", line 703, in kivy._event.EventDispatcher.dispatch
I/python (28963): File "kivy/_event.pyx", line 1214, in kivy._event.EventObservers.dispatch
I/python (28963): File "kivy/_event.pyx", line 1138, in kivy._event.EventObservers._dispatch
I/python (28963): File "/data/data/com.example.test/files/app/_python_bundle/site-packages/kivy/uix/screenmanager.py", line 419, in _on_complete
I/python (28963): self.screen_in.dispatch('on_enter')
I/python (28963): File "kivy/_event.pyx", line 703, in kivy._event.EventDispatcher.dispatch
I/python (28963): File "kivy/_event.pyx", line 1214, in kivy._event.EventObservers.dispatch
I/python (28963): File "kivy/_event.pyx", line 1098, in kivy._event.EventObservers._dispatch
I/python (28963): File "/data/data/com.example.test/files/app/_python_bundle/site-packages/kivy/lang/builder.py", line 64, in custom_callback
I/python (28963): exec(__kvlang__.co_value, idmap)
I/python (28963): File "<string>", line 78, in <module>
I/python (28963): File "main.py", line 178, in load_screen
I/python (28963): manager.add_widget(sc)
I/python (28963): File "/data/data/com.example.test/files/app/_python_bundle/site-packages/kivy/uix/screenmanager.py", line 993, in add_widget
I/python (28963): self.current = screen.name
I/python (28963): File "kivy/properties.pyx", line 483, in kivy.properties.Property.__set__
I/python (28963): File "kivy/properties.pyx", line 524, in kivy.properties.Property.set
I/python (28963): File "kivy/properties.pyx", line 579, in kivy.properties.Property.dispatch
I/python (28963): File "kivy/_event.pyx", line 1214, in kivy._event.EventObservers.dispatch
I/python (28963): File "kivy/_event.pyx", line 1120, in kivy._event.EventObservers._dispatch
I/python (28963): File "/data/data/com.example.test/files/app/_python_bundle/site-packages/kivy/uix/screenmanager.py", line 1056, in on_current
I/python (28963): screen.dispatch('on_enter')
I/python (28963): File "kivy/_event.pyx", line 707, in kivy._event.EventDispatcher.dispatch
I/python (28963): File "/data/data/com.example.test/files/app/uix/screens/screenschedule.py", line 175, in on_enter
I/python (28963): from network import get_data
I/python (28963): File "/data/data/com.example.test/files/app/network/__init__.py", line 3, in <module>
I/python (28963): from kivy.network.urlrequest import UrlRequest
I/python (28963): File "/data/data/com.example.test/files/app/_python_bundle/site-packages/kivy/network/urlrequest.py", line 67, in <module>
I/python (28963): from httplib import HTTPConnection
I/python (28963): File "/data/data/com.example.test/files/app/_python_bundle/stdlib.zip/httplib.py", line 72, in <module>
I/python (28963): File "/data/data/com.example.test/files/app/_python_bundle/stdlib.zip/socket.py", line 47, in <module>
I/python (28963): ImportError: dlopen failed: cannot locate symbol "gethostbyaddr_r" referenced by "_socket.so"...
I/python (28963): Python for android ended.
I/DEBUG (29036): #00 pc 0012856c /data/app/com.example.test-1/lib/arm/libpython2.7.so
env has provided @JonasT , but now with my patch (forked repo): (fix The path python3.7 does not exist ) https://github.com/homdx/p4a-build-spaces/tree/fix/issues-4/src/p4aspaces/environments/p4a-py3-api28ndk21
I googled and the problem appears to be that gethostbyaddr_r
was added in Android 6.0, so on Android 5.0 (which is still supposedly supported by our python 3 recipe) I would expect this error.
Can you tell us which Android version the phone you see this on has?
Now tested from Android 8:
example.test-3n0n7O-r46rsVrubpw67UA==/lib/arm/libpython2.7.so
01-10 23:43:55.194 8879 8995 I python : [ERROR ] [Loader ] Failed to load image <https://cdn.explara.com/logo20170117124754.png>
01-10 23:43:55.194 8879 8995 I python : Traceback (most recent call last):
01-10 23:43:55.194 8879 8995 I python : File "/data/user/0/com.example.test/files/app/_python_bundle/site-packages/kivy/loader.py", line 317, in _load_urllib
01-10 23:43:55.194 8879 8995 I python : fd = urllib_request.urlopen(filename)
01-10 23:43:55.194 8879 8995 I python : File "/data/user/0/com.example.test/files/app/_python_bundle/stdlib.zip/urllib2.py", line 154, in urlopen
01-10 23:43:55.194 8879 8995 I python : return opener.open(url, data, timeout)
01-10 23:43:55.194 8879 8995 I python : File "/data/user/0/com.example.test/files/app/_python_bundle/stdlib.zip/urllib2.py", line 429, in open
01-10 23:43:55.195 8879 8995 I python : response = self._open(req, data)
01-10 23:43:55.195 8879 8995 I python : File "/data/user/0/com.example.test/files/app/_python_bundle/stdlib.zip/urllib2.py", line 447, in _open
01-10 23:43:55.195 8879 8995 I python : '_open', req)
01-10 23:43:55.195 8879 8995 I python : File "/data/user/0/com.example.test/files/app/_python_bundle/stdlib.zip/urllib2.py", line 407, in _call_chain
01-10 23:43:55.195 8879 8995 I python : result = func(*args)
01-10 23:43:55.195 8879 8995 I python : File "/data/user/0/com.example.test/files/app/_python_bundle/stdlib.zip/urllib2.py", line 1241, in https_open
01-10 23:43:55.195 8879 8995 I python : context=self._context)
01-10 23:43:55.195 8879 8995 I python : File "/data/user/0/com.example.test/files/app/_python_bundle/stdlib.zip/urllib2.py", line 1198, in do_open
01-10 23:43:55.195 8879 8995 I python : raise URLError(err)
01-10 23:43:55.195 8879 8995 I python : URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:726)>
01-10 23:44:12.749 8879 8994 I python : [ERROR ] [Loader ] Failed to load image <https://kushaldas.in/images/pyconin15-3.jpg>
01-10 23:44:12.750 8879 8994 I python : Traceback (most recent call last):
01-10 23:44:12.750 8879 8994 I python : File "/data/user/0/com.example.test/files/app/_python_bundle/site-packages/kivy/loader.py", line 317, in _load_urllib
01-10 23:44:12.750 8879 8994 I python : fd = urllib_request.urlopen(filename)
01-10 23:44:12.750 8879 8994 I python : File "/data/user/0/com.example.test/files/app/_python_bundle/stdlib.zip/urllib2.py", line 154, in urlopen
01-10 23:44:12.750 8879 8994 I python : return opener.open(url, data, timeout)
01-10 23:44:12.751 8879 8994 I python : File "/data/user/0/com.example.test/files/app/_python_bundle/stdlib.zip/urllib2.py", line 429, in open
01-10 23:44:12.751 8879 8994 I python : response = self._open(req, data)
01-10 23:44:12.751 8879 8994 I python : File "/data/user/0/com.example.test/files/app/_python_bundle/stdlib.zip/urllib2.py", line 447, in _open
01-10 23:44:12.751 8879 8994 I python : '_open', req)
01-10 23:44:12.751 8879 8994 I python : File "/data/user/0/com.example.test/files/app/_python_bundle/stdlib.zip/urllib2.py", line 407, in _call_chain
01-10 23:44:12.751 8879 8994 I python : result = func(*args)
01-10 23:44:12.751 8879 8994 I python : File "/data/user/0/com.example.test/files/app/_python_bundle/stdlib.zip/urllib2.py", line 1241, in https_open
01-10 23:44:12.751 8879 8994 I python : context=self._context)
01-10 23:44:12.751 8879 8994 I python : File "/data/user/0/com.example.test/files/app/_python_bundle/stdlib.zip/urllib2.py", line 1198, in do_open
01-10 23:44:12.751 8879 8994 I python : raise URLError(err)
01-10 23:44:12.751 8879 8994 I python : URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:726)>
and another Python 3.7 and Android 8:
01-10 23:45:21.106 11661 11752 I python : Traceback (most recent call last):
01-10 23:45:21.106 11661 11752 I python : File "/data/user/0/com.example.test/files/app/_python_bundle/stdlib.zip/urllib/request.py", line 1317, in do_open
01-10 23:45:21.106 11661 11752 I python : encode_chunked=req.has_header('Transfer-encoding'))
01-10 23:45:21.107 11661 11752 I python : File "/data/user/0/com.example.test/files/app/_python_bundle/stdlib.zip/http/client.py", line 1229, in request
01-10 23:45:21.107 11661 11752 I python : self._send_request(method, url, body, headers, encode_chunked)
01-10 23:45:21.107 11661 11752 I python : File "/data/user/0/com.example.test/files/app/_python_bundle/stdlib.zip/http/client.py", line 1275, in _send_request
01-10 23:45:21.107 11661 11752 I python : self.endheaders(body, encode_chunked=encode_chunked)
01-10 23:45:21.107 11661 11752 I python : File "/data/user/0/com.example.test/files/app/_python_bundle/stdlib.zip/http/client.py", line 1224, in endheaders
01-10 23:45:21.107 11661 11752 I python : self._send_output(message_body, encode_chunked=encode_chunked)
01-10 23:45:21.107 11661 11752 I python : File "/data/user/0/com.example.test/files/app/_python_bundle/stdlib.zip/http/client.py", line 1016, in _send_output
01-10 23:45:21.107 11661 11752 I python : self.send(msg)
01-10 23:45:21.107 11661 11752 I python : File "/data/user/0/com.example.test/files/app/_python_bundle/stdlib.zip/http/client.py", line 956, in send
01-10 23:45:21.108 11661 11752 I python : self.connect()
01-10 23:45:21.108 11661 11752 I python : File "/data/user/0/com.example.test/files/app/_python_bundle/stdlib.zip/http/client.py", line 1392, in connect
01-10 23:45:21.108 11661 11752 I python : server_hostname=server_hostname)
01-10 23:45:21.108 11661 11752 I python : File "/data/user/0/com.example.test/files/app/_python_bundle/stdlib.zip/ssl.py", line 412, in wrap_socket
01-10 23:45:21.108 11661 11752 I python : session=session
01-10 23:45:21.108 11661 11752 I python : File "/data/user/0/com.example.test/files/app/_python_bundle/stdlib.zip/ssl.py", line 853, in _create
01-10 23:45:21.108 11661 11752 I python : self.do_handshake()
01-10 23:45:21.108 11661 11752 I python : File "/data/user/0/com.example.test/files/app/_python_bundle/stdlib.zip/ssl.py", line 1117, in do_handshake
01-10 23:45:21.108 11661 11752 I python : self._sslobj.do_handshake()
01-10 23:45:21.108 11661 11752 I python : ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1051)
01-10 23:45:21.109 11661 11752 I python :
01-10 23:45:21.109 11661 11752 I python : During handling of the above exception, another exception occurred:
01-10 23:45:21.109 11661 11752 I python :
01-10 23:45:21.109 11661 11752 I python : Traceback (most recent call last):
01-10 23:45:21.109 11661 11752 I python : File "/data/user/0/com.example.test/files/app/_python_bundle/site-packages/kivy/loader.py", line 317, in _load_urllib
01-10 23:45:21.109 11661 11752 I python : fd = urllib_request.urlopen(filename)
01-10 23:45:21.109 11661 11752 I python : File "/data/user/0/com.example.test/files/app/_python_bundle/stdlib.zip/urllib/request.py", line 222, in urlopen
01-10 23:45:21.109 11661 11752 I python : return opener.open(url, data, timeout)
01-10 23:45:21.109 11661 11752 I python : File "/data/user/0/com.example.test/files/app/_python_bundle/stdlib.zip/urllib/request.py", line 525, in open
01-10 23:45:21.109 11661 11752 I python : response = self._open(req, data)
01-10 23:45:21.109 11661 11752 I python : File "/data/user/0/com.example.test/files/app/_python_bundle/stdlib.zip/urllib/request.py", line 543, in _open
01-10 23:45:21.109 11661 11752 I python : '_open', req)
01-10 23:45:21.109 11661 11752 I python : File "/data/user/0/com.example.test/files/app/_python_bundle/stdlib.zip/urllib/request.py", line 503, in _call_chain
01-10 23:45:21.109 11661 11752 I python : result = func(*args)
01-10 23:45:21.109 11661 11752 I python : File "/data/user/0/com.example.test/files/app/_python_bundle/stdlib.zip/urllib/request.py", line 1360, in https_open
01-10 23:45:21.109 11661 11752 I python : context=self._context, check_hostname=self._check_hostname)
01-10 23:45:21.109 11661 11752 I python : File "/data/user/0/com.example.test/files/app/_python_bundle/stdlib.zip/urllib/request.py", line 1319, in do_open
01-10 23:45:21.109 11661 11752 I python : raise URLError(err)
01-10 23:45:21.109 11661 11752 I python : urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1051)>
That's normal/expected, there are no system certificates available per default. You need to either ship the specific cert, or e.g. include mozilla's cert bundle yourself and make OpenSSL use it. (Or use the horrible/insecure solution and disable certificate verification)
Why is normal? Old version this application are work correctly. Old version are compiled by python 2 and buildozer==0.34. Why again recompile under new version with p4a (python 2 and 3) all Python's give are error on open url by https:// ? Opens only by http!
Oh that worked? Interesting. It never worked for me, so maybe someone else knows (I manually ship the mozilla cert bundle and make openssl use it, then it works)
You need source of project? https://github.com/pydelhi/pydelhi_mobile Need old apk version? 3.tar.gz
Oh that worked? Interesting. It never worked for me, so maybe someone else knows (I manually ship the mozilla cert bundle and make openssl use it, then it works)
Check 3.apk on you phone) Or compile with old api and and with buildozer==0.34 and cython==0.25.2 with default settings
I checked again, and writed new update on this issue: https://github.com/kivy/python-for-android/pull/1217
Build apk only with: p4a-py3-api28ndk21. With p4a-py2-api19-ndkbundle Compile give error:
[INFO]: -> running basename https://github.com/kennethreitz/requests/archive/v2.13.0.tar.gz
[INFO]: -> directory context /root/.local/share/python-for-android/build/other_builds/requests-python2/armeabi-v7a__ndk_target_19
Traceback (most recent call last):
File "/usr/local/bin/p4a", line 11, in <module>
load_entry_point('python-for-android==0.6.0', 'console_scripts', 'p4a')()
File "/usr/local/lib/python2.7/dist-packages/pythonforandroid/toolchain.py", line 1033, in main
ToolchainCL()
File "/usr/local/lib/python2.7/dist-packages/pythonforandroid/toolchain.py", line 553, in __init__
getattr(self, args.subparser_name.replace('-', '_'))(args)
File "/usr/local/lib/python2.7/dist-packages/pythonforandroid/toolchain.py", line 150, in wrapper_func
build_dist_from_args(ctx, dist, args)
File "/usr/local/lib/python2.7/dist-packages/pythonforandroid/toolchain.py", line 191, in build_dist_from_args
build_recipes(build_order, python_modules, ctx)
File "/usr/local/lib/python2.7/dist-packages/pythonforandroid/build.py", line 619, in build_recipes
recipe.prepare_build_dir(arch.arch)
File "/usr/local/lib/python2.7/dist-packages/pythonforandroid/recipe.py", line 483, in prepare_build_dir
self.unpack(arch)
File "/usr/local/lib/python2.7/dist-packages/pythonforandroid/recipe.py", line 385, in unpack
sh.tar('xf', extraction_filename)
File "/usr/local/lib/python2.7/dist-packages/sh.py", line 1427, in __call__
return RunningCommand(cmd, call_args, stdin, stdout, stderr)
File "/usr/local/lib/python2.7/dist-packages/sh.py", line 774, in __init__
self.wait()
File "/usr/local/lib/python2.7/dist-packages/sh.py", line 792, in wait
self.handle_command_exit_code(exit_code)
File "/usr/local/lib/python2.7/dist-packages/sh.py", line 815, in handle_command_exit_code
raise exc
sh.ErrorReturnCode_2:
RAN: /bin/tar xf /root/.local/share/python-for-android/packages/requests/v2.13.0.tar.gz
STDOUT:
STDERR:
gzip: stdin: not in gzip format
/bin/tar: Child returned status 1
/bin/tar: Error is not recoverable: exiting now
cat .p4a
--arch=armeabi-v7a
--name 'Py Delhi'
--package com.example.test
--version 1
--icon data/icon.png
--presplash=../screen.png
--permission=INTERNET
--requirements=python2host,android,openssl,kivy,futures,requests
less /root/.local/share/python-for-android/packages/requests/v2.13.0.tar.gz
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
Sources, my forked repo: https://github.com/homdx/pydelhi_mobile/tree/api28
@nontxt the SSL module should build on p4a's latest git master now, so hopefully this should be resolved! I'll close the ticket for now, if it doesn't actually work let me know and I can reopen
@homdx if you still have some of these other issues, can you make a separate ticket to keep things a bit cleaner?
So, I have some issues when I try build my kivy project with python 3.7.1 and requests module. 1st issue: When I tried build project with unopen python modules, I got issue with python version (venv can't found python3.7). I fixed it when I made altinstall python 3.7.1 2nd issue: Now venv found python3.7 and install requirements modules but it can't install dependes for this modules(for example requests) For fix this issues i added all dependes in requirements list. It'is works! Finally I got apk. I deployed it at my device and got SSLError: "Can't connect to HTTPS URL because the SSL module is not available."
Anybody have idea?
Versions
Description
// REPLACE ME: What are you trying to get done, what has happened, what went wrong, and what did you expect?
buildozer.spec
Spec file: `[app]
title = Qiwi Wallets package.name = QWS package.domain = org.qws source.dir = . source.include_exts = py,png,jpg,kv,atlas version = 1.6.3 requirements = python3,kivy==1.10.1,openssl,qiwipy,urllib3,python-dateutil,chardet,certifi,idna,requests icon.filename = %(source.dir)s/icon.png orientation = portrait osx.python_version = 3 osx.kivy_version = 1.9.1 fullscreen = 0 android.permissions = INTERNET android.api = 27 android.minapi = 21 android.sdk = 28 android.ndk_path = /home/kivy/Android/android-ndk-r16b/ android.sdk_path = /home/kivy/Android/android-sdk-28/`
Logs
`12-25 14:25:17.397 5719 5736 I python : [WARNING] [Config ] Older configuration version detected (0 instead of 20)
12-25 14:25:17.397 5719 5736 I python : [WARNING] [Config ] Upgrading configuration in progress. 12-25 14:25:17.411 5719 5736 I python : [INFO ] [Logger ] Record log in /data/user/0/org.qws.qws/files/app/.kivy/logs/kivy_18-12-25_0.txt 12-25 14:25:17.412 5719 5736 I python : [INFO ] [Kivy ] v1.10.1 12-25 14:25:17.413 5719 5736 I python : [INFO ] [Python ] v3.7.1 (default, Dec 25 2018, 08:27:52) 12-25 14:25:17.413 5719 5736 I python : [Clang 5.0.300080 ] 12-25 14:25:17.685 5719 5736 I python : [INFO ] [Factory ] 194 symbols loaded 12-25 14:25:18.281 5719 5736 I python : [INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_gif (img_pil, img_ffpyplayer ignored) 12-25 14:25:18.603 5719 5736 I python : [INFO ] [Window ] Provider: sdl2 12-25 14:25:18.647 5719 5736 I python : [INFO ] [GL ] Using the "OpenGL ES 2" graphics system 12-25 14:25:18.648 5719 5736 I python : [INFO ] [GL ] Backend used 12-25 14:25:18.648 5719 5736 I python : [INFO ] [GL ] OpenGL version <b'OpenGL ES 3.1 V@139.0 (GIT@I43097da1fb)'> 12-25 14:25:18.649 5719 5736 I python : [INFO ] [GL ] OpenGL vendor <b'Qualcomm'> 12-25 14:25:18.649 5719 5736 I python : [INFO ] [GL ] OpenGL renderer <b'Adreno (TM) 510'> 12-25 14:25:18.649 5719 5736 I python : [INFO ] [GL ] OpenGL parsed version: 3, 1 12-25 14:25:18.650 5719 5736 I python : [INFO ] [GL ] Texture max size <16384> 12-25 14:25:18.650 5719 5736 I python : [INFO ] [GL ] Texture max units <16> 12-25 14:25:18.717 5719 5736 I python : [INFO ] [Window ] auto add sdl2 input provider 12-25 14:25:18.718 5719 5736 I python : [INFO ] [Window ] virtual keyboard not allowed, single mode, not docked 12-25 14:25:18.772 5719 5736 I python : [INFO ] [Text ] Provider: sdl2 12-25 14:25:18.841 5719 5736 I python : Traceback (most recent call last): 12-25 14:25:18.841 5719 5736 I python : File "/data/user/0/org.qws.qws/files/app/_python_bundle/site-packages/urllib3/connectionpool.py", line 588, in urlopen 12-25 14:25:18.843 5719 5736 I python : conn = self._get_conn(timeout=pool_timeout) 12-25 14:25:18.843 5719 5736 I python : File "/data/user/0/org.qws.qws/files/app/_python_bundle/site-packages/urllib3/connectionpool.py", line 248, in _get_conn 12-25 14:25:18.844 5719 5736 I python : return conn or self._new_conn() 12-25 14:25:18.844 5719 5736 I python : File "/data/user/0/org.qws.qws/files/app/_python_bundle/site-packages/urllib3/connectionpool.py", line 816, in _new_conn 12-25 14:25:18.846 5719 5736 I python : raise SSLError("Can't connect to HTTPS URL because the SSL " 12-25 14:25:18.846 5719 5736 I python : urllib3.exceptions.SSLError: Can't connect to HTTPS URL because the SSL module is not available. 12-25 14:25:18.846 5719 5736 I python : 12-25 14:25:18.847 5719 5736 I python : During handling of the above exception, another exception occurred: 12-25 14:25:18.847 5719 5736 I python : 12-25 14:25:18.847 5719 5736 I python : Traceback (most recent call last): 12-25 14:25:18.848 5719 5736 I python : File "./requests/adapters.py", line 449, in send 12-25 14:25:18.849 5719 5736 I python : timeout=timeout 12-25 14:25:18.849 5719 5736 I python : File "/data/user/0/org.qws.qws/files/app/_python_bundle/site-packages/urllib3/connectionpool.py", line 638, in urlopen 12-25 14:25:18.851 5719 5736 I python : _stacktrace=sys.exc_info()[2]) 12-25 14:25:18.851 5719 5736 I python : File "/data/user/0/org.qws.qws/files/app/_python_bundle/site-packages/urllib3/util/retry.py", line 398, in increment 12-25 14:25:18.852 5719 5736 I python : raise MaxRetryError(_pool, url, error or ResponseError(cause)) 12-25 14:25:18.852 5719 5736 I python : urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='edge.qiwi.com', port=443): Max retries exceeded with url: /payment-history/v2/persons/79896340050/payments?rows=10&startDate=2018-12-25T00%3A00%3A00%2B03%3A00&endDate=2018-12-25T23%3A59%3A59%2B03%3A00 (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) 12-25 14:25:18.853 5719 5736 I python : 12-25 14:25:18.853 5719 5736 I python : During handling of the above exception, another exception occurred: 12-25 14:25:18.853 5719 5736 I python : 12-25 14:25:18.853 5719 5736 I python : Traceback (most recent call last): 12-25 14:25:18.854 5719 5736 I python : File "main.py", line 155, in 12-25 14:25:18.854 5719 5736 I python : make_dict() 12-25 14:25:18.855 5719 5736 I python : File "main.py", line 136, in make_dict 12-25 14:25:18.855 5719 5736 I python : history = wallet.history(10, start_date=today, end_date=timeNow)['transactions'] 12-25 14:25:18.856 5719 5736 I python : File "/data/user/0/org.qws.qws/files/app/_python_bundle/site-packages/pyqiwi/init.py", line 160, in history 12-25 14:25:18.856 5719 5736 I python : next_txn_date=next_txn_date, next_txn_id=next_txn_id) 12-25 14:25:18.857 5719 5736 I python : File "/data/user/0/org.qws.qws/files/app/_python_bundle/site-packages/pyqiwi/apihelper.py", line 118, in payment_history 12-25 14:25:18.858 5719 5736 I python : return _make_request(token, api_method, params=params) 12-25 14:25:18.858 5719 5736 I python : File "/data/user/0/org.qws.qws/files/app/_python_bundle/site-packages/pyqiwi/apihelper.py", line 42, in _make_request 12-25 14:25:18.859 5719 5736 I python : proxies=proxy, headers=headers, json=json) 12-25 14:25:18.859 5719 5736 I python : File "./requests/sessions.py", line 533, in request 12-25 14:25:18.860 5719 5736 I python : resp = self.send(prep, send_kwargs) 12-25 14:25:18.861 5719 5736 I python : File "./requests/sessions.py", line 646, in send 12-25 14:25:18.862 5719 5736 I python : r = adapter.send(request, kwargs) 12-25 14:25:18.862 5719 5736 I python : File "./requests/adapters.py", line 514, in send 12-25 14:25:18.863 5719 5736 I python : raise SSLError(e, request=request) 12-25 14:25:18.864 5719 5736 I python : requests.exceptions.SSLError: HTTPSConnectionPool(host='edge.qiwi.com', port=443): Max retries exceeded with url: /payment-history/v2/persons/79896340050/payments?rows=10&startDate=2018-12-25T00%3A00%3A00%2B03%3A00&endDate=2018-12-25T23%3A59%3A59%2B03%3A00 (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) 12-25 14:25:18.983 5719 5736 I python : Python for android ended.`