I built a snap using python3 plugin. It should open a PyQt5 app. The snap built with no problem, but after the snap is installed, calling the installed python script in command line fails with the error below.
name: pyqthelloworld version: 0.1.0 summary: pyqt hello world description: | a pyqt5 python3 hello world test confinement: strict apps: pyqthelloworld: command: pyqthelloworld parts: pyqthelloworld: plugin: python3 source: git://github.com/ericoporto/pyqthelloworld source-type: git stage-packages: - python3-pyqt5 - libc-bin - locales
I built and installed using the commands below
snapcraft stage snapcraft snap sudo snap install pyqthelloworld_0.1.0_amd64.snap
In command line
$ pyqthelloworld Fatal Python error: Py_Initialize: Unable to get the locale encoding ImportError: No module named 'encodings' Current thread 0x00007fb8fc0ff700 (most recent call first): Aborted (core dumped)
What's wrong? And how do I debug similar errors in snaps?
I am using Ubuntu 16.04 LTS 64-bit
Edit: checking if encodings is there (is this correct?)
user@pc:~/git/pyqthelloworld/snap$ find . -iname encodings ./prime/usr/lib/python3.5/encodings ./parts/pyqthelloworld/install/usr/lib/python3.5/encodings ./stage/usr/lib/python3.5/encodings
Edit2: I am now getting (snapcraft 2.15.1):
$ pyqthelloworld This application failed to start because it could not find or load the Qt platform plugin "xcb". Reinstalling the application may fix this problem. Aborted (core dumped)
Just to clarify, no changes, just a newer snapcraft on the same (and updated) Ubuntu 16.04 computer.
Now I added a snap folder, where I am keeping the snapcraft.yaml (which is now a little different than the one in the beginning of this question!) and a little wrapper to deal with the locale error - which I don't think should be needed.
Now when I run the command (pyqthelloworld) for the installed snap I am getting:
This application failed to start because it could not find or load the Qt platform plugin "xcb" in "". Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, xcb. Reinstalling the application may fix this problem. Aborted (core dumped)