Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3 unicode print () / copy to clipboard crashes app on Android #404

Closed
NumesSanguis opened this issue Sep 26, 2016 · 2 comments
Closed

Comments

@NumesSanguis
Copy link

NumesSanguis commented Sep 26, 2016

I posted this problem originally at the Kivy branch, but since it is still happening with Python 3 (while now the terminal should default to unicode instead of ascii), I thought it might be more relevant here.

kivy/kivy#3606
kivy/kivy#2345

Summary:
Android console can't handle Unicode characters it seems. It works on Ubuntu and Windows though.
print("Unicode/non-ascii string 愛") # --> crash

I thought switching to Python 3.5 would solve the case, but it still crashes on Android 6. (I build my app with python3 -m buildozer android debug deploy run, with buildozer-master cloned today (3 days ago)).

Here is an example of the problem: https://github.com/SurafuSoft/kivy_doubletap_clipboard

Print statement crash: https://github.com/SurafuSoft/kivy_doubletap_clipboard/blob/master/main.py#L58
Copy to clipboard crash: https://github.com/SurafuSoft/kivy_doubletap_clipboard/blob/master/main.py#L67

@inclement
Copy link
Member

For the logcat stream this is really a python-for-android issue, it arises from the semi-crude way we pass the python output to logcat (via C/JNI), and can presumably be fixed by some appropriate encoding/decoding of the unicode.

I guess something similar is true for the clipboard, but this one probably counts as a kivy bug - it would be helpful to open an issue in the kivy repo if there isn't one already.

@NumesSanguis
Copy link
Author

Sorry, I didn't build it with the 'android_new' argument, so it still used Python2.7, even with the python3 -m command. My current issue (after successfully building an app): #410

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants