简体   繁体   中英

python3 buildozer kivy ascci codec cant decode

OS: ubuntu 16.04

I am having problems deploying my kivy app to my android phone.

when I type buildozer android_new debug deploy run in the terminal I get the error

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 1658: orinal not in range(128)

does anyone know how I can fix this?

Josh

I recently had a similar problem when building python/kivy/buildozer environment in Docker. The base image was Ubuntu 16.04, so I think it may work for you, too.

In my case, locale isn't installed by default in the Ubuntu Docker image, so I had to install it with apt-get install -y locales , but I don't think you'll need to do that.

First, run:

locale -a 

This will display all of the locales available on your system. If you see the locale you need listed, then use locale to see what LC_ALL and LANG are set to. If they're not set to what you need, or they are set to POSIX , then skip to step four.

Second, generate the locale file. In my case, I needed the US English version; thus my command was:

locale-gen en_US.UTF-8

If you need a different language, you'll need to look up which filename fits your needs.

Third, updated it like so:

update-locale en_US.UTF-8

Fourth, use the following commands to update the environment variables Buildozer/Python will look for:

export LC_ALL=$(locale -a | grep en_US)
export LANG=$(locale -a | grep en_US)

Note that I am using grep, because I found that the locale files that end up on the local system don't always have the same extension, but the naming convention for the first part of the filename seems to be consistent.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM