Cant package Thonny Snap

Hey ogra, i tried with a different user but same problem persists

Full log :-

Traceback (most recent call last):
  File "/snap/thonny-ide/9/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/snap/thonny-ide/9/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/snap/thonny-ide/9/lib/python3.10/site-packages/thonny/__main__.py", line 4, in <module>
    launch()
  File "/snap/thonny-ide/9/lib/python3.10/site-packages/thonny/__init__.py", line 234, in launch
    prepare_thonny_user_dir()
  File "/snap/thonny-ide/9/lib/python3.10/site-packages/thonny/__init__.py", line 280, in prepare_thonny_user_dir
    os.makedirs(THONNY_USER_DIR, mode=0o700, exist_ok=True)
  File "/snap/thonny-ide/9/lib/python3.10/os.py", line 225, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/home/sam/.config/Thonny'

The problem seems to be related with runpy.py

well, the problem is with THONNY_USER_DIR … which seems to properly point to SNAP_USER_DATA (or even HOME which normally defaults to SNAP_USER_DATA in snaps) for me on all test machines, but interestingly not for you …

you could try to add an environment: block to your apps: section to force THONNY_USER_DIR to point to SNAP_USER_DATA by default, that should even solve it for you.

also, what does:

$ env | grep THONNY

return on your system ?

hey ogra after intense research i came to the temporary solution, with this the app runs --> /snap/thonny-ide/current/bin/thonny, this needs to be fixed

env | grep THONNY Returns nothing, the command exits

can you explain in detail how to add the environment part for core22, i will also check this out

this is not a solution, it is even sheer luck that it starts at all, you circumvent confinement and all setup scripts of the snap and run it natively … which will now have again polluted your system in ~/.cache i guess …

you simply add it to your apps: entry just like the plugs and command:

it takes a list of keys and values…

Understood with this --> Declaratively defining environment variables

Hey there yes after successfully adding it the app runs but its interpreter wont run i mean py programs wont run due to --:

OSError: [Errno 30] Read-only file system: ‘SNAP_USER_DATA’

I think some extra work is needed to allow it run files also the cursor it uses isnt of system i mean we should also add a gtk-common-themes plug ??

it is a variable … you want a leading dollar sign there to have it expanded to a path …

ok changing it, in the yaml

The app is working fine but wont open from menu, i think its due to snap being thonny-ide but desktop file being thonny, changed it building again

(FIXED SUCCESSFULLY)

1 Like

Any idea building the snap with gnome-3.38 ext gives the following error :

- duplicate entries in 'plugs' not permitted in 'apps.thonny-ide' configuration

But nothing is duplicate in plugs also in extensions it wont allow me to use [gnome-38], it will only work if i use [gnome], i want to use gnome-extension to let my snap use xdg-portals to work in a much better way

Full log --> https://launchpadlibrarian.net/653971715/buildlog_snap_ubuntu_jammy_amd64_287b1f6c23f389c5c567828f1f683c3b_BUILDING.txt.gz

Canary or proposed YAML

Successfully packaged snap with gnome 42 base to make it possible to use gtk portal… :smiling_face_with_three_hearts: :heart_eyes:

1 Like

Successfully added Dbus slot and registered app with gtk or dbus whatever :grin:

2 Likes