Python: error with a relative path


#1

Hi!
I’m trying to build a snap for a little soft I’ve developped long time ago wih Gtk3 and Python.
It’s Coulr: https://github.com/Huluti/Coulr.

I don’t need any plugs or big changes in the code but I’ve a problem with only one path.
Here’s the snapcraft.yaml.
The app is just one file: https://github.com/Huluti/Coulr/blob/master/coulr/main.py.
And here’s the setup.py.

When I launch the snap I’ve this error:

self.logo = GdkPixbuf.Pixbuf.new_from_file(logo_path)
GLib.Error: g-file-error-quark: Failed to open file 'assets/coulr.png': No such file or directory (4)

Here’s the concerned part of the code:

logo_path = "assets/{name}.png".format(name=self.app)
self.save_file = "{}/.config/{}.json".format(home_path, self.app)
self.logo = GdkPixbuf.Pixbuf.new_from_file(logo_path)

While the coulr.png file is really stored in /snap/coulr/current/lib/python3.5/site-packages/coulr/assets

Maybe I don’t understand how to call this file in python…

Thank’s in advance!


#2

I’ve fixed the problem in this commit: