Buildozer, add csv library

691 views
Skip to first unread message

Halox

unread,
Mar 10, 2014, 8:06:02 PM3/10/14
to kivy-...@googlegroups.com
I completed a small dictionary app, it relies on csv files for importing data. Is there anyway to add csv library to the buildozer package.


I tried to write "requirements = kivy,csv" to the spec file, failed with


# Command failed: pip-2.7 install --download-cache=/home/mbp/.buildozer/cache --target=/home/mbp/build/.buildozer/applibs csv

Assuming failure of pip is normal, as csv is a standart library. Yet if I package without csv requirement, it succeeds but does not run on device. 

thank you for reading

Alexander Taylor

unread,
Mar 10, 2014, 8:24:12 PM3/10/14
to kivy-...@googlegroups.com
I think csv is blacklisted in python-for-android. You should be able to delete it at .buildozer/android/platform/python-for-android/src/blacklist.txt , then delete and rebuild your python distribution in python-for-android/dist

Halox

unread,
Mar 11, 2014, 8:44:40 AM3/11/14
to kivy-...@googlegroups.com
Removed it from blacklist, and recompiled

But I still see

I/python  (17874):    File "/home/mbp/build/.buildozer/android/app/main.py", line 7, in <module>
I/python  (17874):    File "/home/mbp/build/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/csv.py", line 8, in <module>
I/python  (17874):  ImportError: No module named _csv
I/python  (17874): Python for android ended.
I/ActivityManager(  411): Process org.testy.sozluk.sozluk:python (pid 17874) has died.
in logcat

Michael Currie

unread,
Sep 27, 2015, 6:16:06 PM9/27/15
to Kivy users support
I had the same issue, and it turns out there are TWO blacklist files.  You should remove it from both.  Here's my makefile that I used to handle the issue:

# Remove any previous buildozer files from the folder

 

buildozer android clean

git pull


 

# Create the .buildozer folder and download its subcomponents, including the blacklist.txt file we are about to modify

buildozer android update


 

# Remove the line containing csv so the csv module is installed, as per the warning on

# http://python-for-android.readthedocs.org/en/latest/usage/#step-2-package-your-application

# grep -v reverses the search, showing all lines except the one matching the pattern


 

cwd
=$(pwd)


 

# INSTALL CSV module

# This requires removing _csv from the two blacklist files

# According to

# https://groups.google.com/forum/#!msg/kivy-users/mgisdssF39M/28vgOWfM0y0J

# There are 2 locations for blacklist.txt:

# - one is inside .buildozer/android/platform/python-for-android/src/ and

# - the other is in python-for-android/dist/distname

# the first changes the blacklist for every compilation;

# the second for a specific compilation.

cd
.buildozer/android/platform/python-for-android/src/

cat blacklist
.txt | grep -v "_csv" > blacklist.txt2

rm blacklist
.txt

mv blacklist
.txt2 blacklist.txt


 

cd $cwd


 

cd
.buildozer/android/platform/python-for-android/dist/lanki/

cat blacklist
.txt | grep -v "_csv" > blacklist.txt2

rm blacklist
.txt

mv blacklist
.txt2 blacklist.txt


 

cd $cwd


 

# Use time to report the time it took to execute the command

time buildozer
--verbose android debug

# Make a beep sound over the terminal interface on my local machine to tell me it's done

echo $
'\a'

Michael Currie

unread,
Sep 27, 2015, 6:16:08 PM9/27/15
to Kivy users support
I'm having the same issue.

Even after removing the _csv line from blacklist.txt, and re-running `buildozer android debug`, logcat shows ImportError: No module named _csv. 


On Tuesday, March 11, 2014 at 6:44:40 AM UTC-6, Halox wrote:

Michael Currie

unread,
Sep 27, 2015, 6:16:09 PM9/27/15
to Kivy users support
Here's a gotcha: blacklist.txt appears in TWO places.  You should remove the line from both.  Here's another thread on the issue:



On Tuesday, March 11, 2014 at 6:44:40 AM UTC-6, Halox wrote:
Reply all
Reply to author
Forward
0 new messages