clickable and Python/QML App ImportError: No module named 'encodings'
I'm trying to launch simple 'Hello World' app from touch panel, but logs shows that there is:
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'
From the console python and app launches very well, but not from click panel. I'm trying to dig into app.apparmor policy groups, but there nothing to add in this case. Also I had seen that in the app directory is lib/arm-linux-gnueabihf which contains libpython3.4m* libraries.
There is also /userdata/systme-data path, but there nothing in this case to import anything for python only etc/:opt/ and var/ system dirs.
So my questions are:
- Which user is launching apps from panel?
- How does apparmor participates in this process?
- Which python package participates in this process and from which directory?
Following from previous questions:
- How to permit process which launching apps to read $PATH and $PYTHONPATH variables and to get everything what python needs?
@ropod7 I ran into same errors when I tried to use clickable app template. It is not ported to xenial.
So just use python build template and remove local python libs.
@neopar Thank you. It works. Just removed lib/ directory from project.
clickable --desktopalso didn't work for me. On desktop I use qmlscene for testing.
It's did not work for me to. I will try your method. Thanks.
So, it is not so comfortable to remove lib/ dir from the project on the phone at each installation. Easier to move python_lib/ dir from the source of project on desktop to somewhere and comment on the CMakeLists.txt file just one line:
And it works.
@neopar I found solution to publish xenial python apps created on clickable.
- We need to remove all *3.4m python libs from local projects lib/ directory and also libpyothersideplugin.so from there;
- Download from device system libs libpython3.5m.so.1.0 and libpython3.5m.so.1;
- Edit python-lib/CMakeLists.txt to replace all 3.4 to 3.5;
After all we may upload apps to the open-store.io
Ubuntu Touch is awesome in case of app development. I've created one simple app. Need test.
Hi @ropod7, can you tell why you're doing steps 2 and 3 now? What you've written in your fore last post was more what I had expected.
@hummlbach Otherwise xenial returns encodings import error in my device. Xenial has python3.5 on a board and while calling clickable review --xenial before clickable publish --xenial - desktop returns that no python libs on an app board.
In the last case after clickable --xenial we do not need to remove anything at the device side. Everything works from scratch.
@hummlbach It is just one time process moving libs into the python-lib/
After that project is compatible for xenial. I don't know how abot previous 15.04, but in xenial case it works.