Do I need a recipe for base Python functions like csv with p4a?

18 views
Skip to first unread message

Roger Morrell

unread,
Dec 6, 2018, 3:40:14 PM12/6/18
to Kivy users support
I have a Kivy app that uses some basic python functions such as JSON, CSV , os and sys that are part of the python language spec
When I compile  with p4a  there are no errors but the app fails on execution when trying to do a import json saying it can't find json

it does fail if I include it under requirements which are --requirements=python3,kivy
so --requirements=python3,kivy,csv  does not work -  it can't find it 

If I comment out the import json the app runs OK except where it needs use a json function.

I looked at creating a recipe for json (and the others) but while I can find the source of these functions in GitHub, they are Cython library functions the Recipe function require the source to be in a compressed format like .zip , which I can't find.
 
I can understand how some library that is not in the basic Python language would need a recipe such those that  are in PYPI

I  must be missing something basic as others must have done this

Roger

Alexander Taylor

unread,
Dec 7, 2018, 3:46:54 PM12/7/18
to Kivy users support
No, you don't need a recipe for builtin modules.

It looks like we blacklist _json.so from the APK, probably to save space, but it's a bit unnecessary. You should be able to whitelist it by creating a file "whitelist.txt" containing the line "lib-dynload/_json.so", and pass the path to that file to the whitelist argument for buildozer or p4a.

Robert Flatt

unread,
Dec 7, 2018, 8:21:01 PM12/7/18
to Kivy users support
For reference, this blacklist can be found here (your Python version may vary):

/usr/local/lib/python3.6/dist-packages/pythonforandroid/bootstraps/sdl2/build/blacklist.txt

Roger Morrell

unread,
Dec 8, 2018, 2:53:40 PM12/8/18
to Kivy users support
Thanks to Alexander and Robert for the information about the blacklist- that solved the problem.  Also I had tried putting those module name e.g. csv in the requirements, this is not needed and causes it to fail

Roger
Reply all
Reply to author
Forward
0 new messages