Python init-fs-encoding fatal error

I have been really stuck trying to make a snap of “netana”. Any help would really be appreciated.
– Jim
natana is at: https://github.com/jrbainter/netana.git

++++++ .yaml ++++++++
name: netana
version: ‘3.1.18’
summary: Electronic Network Analyzer
description: |
This program solves electronic AC & DC Mash and Node network
equations using matrix algebra.

base: core20
grade: devel
confinement: devmode

#layout:
#/usr/bin/env:
#symlink: $SNAP/usr/bin/env
#/usr/lib/python3.8/tkinter:
#symlink: $SNAP/usr/lib/python3.8/tkinter

parts:
netana:
plugin: python
source: ./netana
stage-packages:
- python3.8
- python3-tk
- python3-matplotlib
- python3-numpy
plugin: dump
organize:
“*.py” : bin

apps:
netana:
command: bin/main.py
environment:
PATH: “$SNAP/usr/lib/python3.8:$SNAP/usr/lib:$SNAP/usr/bin/”
PYTHONHOME: “$SNAP/usr/lib/python3.8”
plugs: [home]

+++++++++++++++++ end .yaml ++++++++++

I am trying snap a tkinter gui python3 program and get a init-fs-encoding fatal error when I invoke my
snap program “netana”. Error follows:

netana 3.1.18 installed
jim@powder:~/netana/netana$ netana
Python path configuration:
PYTHONHOME = ‘/snap/netana/x1/usr/lib/python3.8’
PYTHONPATH = (not set)
program name = ‘/usr/bin/python3’
isolated = 0
environment = 1
user site = 1
import site = 1
sys._base_executable = ‘/usr/bin/python3’
sys.base_prefix = ‘/snap/netana/x1/usr/lib/python3.8’
sys.base_exec_prefix = ‘/snap/netana/x1/usr/lib/python3.8’
sys.executable = ‘/usr/bin/python3’
sys.prefix = ‘/snap/netana/x1/usr/lib/python3.8’
sys.exec_prefix = ‘/snap/netana/x1/usr/lib/python3.8’
sys.path = [
‘/snap/netana/x1/usr/lib/python3.8/lib/python38.zip’,
‘/snap/netana/x1/usr/lib/python3.8/lib/python3.8’,
‘/snap/netana/x1/usr/lib/python3.8/lib/python3.8/lib-dynload’,
]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named ‘encodings’

Current thread 0x00007f866fa3f740 (most recent call first):

1 Like

Have the same issue. Did you solve it?

Would it work if, instead of setting PYTHONHOME, you start the application invoking the Python interpreter (something like command: bin/python3 bin/main.py)? Also note that you have two plugin declarations in your netana part (plugin: python and plugin: dump), I’m assuming you want the python plugin.

Just to make formatting better when posting a yaml, you can use triple backquotes (```) before and after the file content to preserve the original indentation.