Need some help with Python packaging

Hi!

I am a newcomer in the world of snaps and I try to package my app: ImEditor.
It’s a Gtk3 Python image editor that works with Pillow as dependency.

Here’s what I have already done to prepare my app:

https://github.com/ImEditor/ImEditor/commit/ebf6e45c1d49617a751410301e8bed43dff42d75

For building the snap, I use the GitHub build feature of the snapcraft website.
My snap is in the store but can’t be launched… I must have missed something. Do not hesitate to give me some advice so that I try to understand how it works.

Thank’s in advance!

The first problem I’ve noticed is that your snap doesn’t assert any interfaces, according to your website it seems that your application is an image editor with a graphical interface, which indicates:

  • It needs to access the desktop interfaces, connect the snap to the desktop, desktop-legacy, unity7, wayland, and x11 interfaces
  • It needs regular file access, connect the snap to the home and removable-media interfaces.

Thank you very much for your reply. I knew that I had to make some changes to respect the concept of sandboxing but I even stumble on the step before that is only to launch at least the software (even if it does not work yet)…

I have made two commits without more success: https://github.com/ImEditor/ImEditor/commit/e75e5e2d94e4b9eea3847b130e1bc49924812341 and https://github.com/ImEditor/ImEditor/commit/ae62e8c83d8db53d2bab229d754b71599347ba08.

Here’s the command that the .desktop is trying to launch (seen via alacarte):

env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/imeditor_imeditor.desktop /snap/bin/imeditor %U

If I enter this command manually in a terminal, here’s the result:

Traceback (most recent call last):
  File "/snap/imeditor/11/bin/imeditor.py", line 4, in <module>
    gi.require_version('Gtk', '3.0')
  File "/snap/imeditor/11/usr/lib/python3/dist-packages/gi/__init__.py", line 102, in require_version
    raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace Gtk not available

Moreover, the icon of the soft isn’t visible in Gnome Shell.

The Gtk dependencies are likely not staged into the snap, you should revert the change that drops the desktop-gtk3 remote part and start locating the missing packages according to your execution results.

Currently the desktop entry needs manual patching to point the Icon key’s value to the proper location, refer:

Thank’s for your help. Here’s some updates:

  • The icon problem is fixed thank’s to your links.
  • The problem of dependencies is fixed by adding the “desktop-launch” script in the command key.

Now, there is an other error:

Traceback (most recent call last):
  File "/snap/imeditor/17/bin/imeditor.py", line 8, in <module>
    from imeditor.interface.interface import Interface
  File "/snap/imeditor/17/bin/imeditor.py", line 8, in <module>
    from imeditor.interface.interface import Interface
ImportError: No module named 'imeditor.interface'; 'imeditor' is not a package

You can see all the changes related to my snap package here.

1 Like

I’ve fixed the problem with this commit:
https://github.com/ImEditor/ImEditor/commit/b2fe3b8d39ffffcae6d75ff4fa5ef218317dd8a5

1 Like