Skip to content

csv module #54

Closed
Closed

Description

@dcorio

csv is included in the standard library, but i cannot load the module on android.

adb logcat says this:

I/python (20884): File "/home/enlightx/Development/Kivy/python-for-android/build/python-install/lib/python2.7/csv.py", line 8, in
I/python (20884): ImportError: No module named _csv

Activity

  1. tshirtman commented on Oct 8, 2012

    @tshirtman
    Member

    It's part of the modules that are blacklisted by default to make the shipping packages lighter, you can safely reactivate it by editing the blacklist.txt file of your python-for-android distribution.

  2. dcorio commented on Oct 8, 2012

    @dcorio
    Author

    thanks!

  3. MichaelCurrie commented on Sep 26, 2015

    @MichaelCurrie

    Keep in mind from https://groups.google.com/forum/#!msg/kivy-users/mgisdssF39M/28vgOWfM0y0J that:

    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 other for a specific compilation.

    So don't forget to remove it from BOTH. I accomplished that with the following lines in my makefile bash script (my app is called lanki):

    # 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
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions