in my python application I’m using webbrowser.open from the python standard library to open website links from within my application. This does work fine outside of snaps as expected, but as soon as I try to open them from a snap application it fails with
Error org.freedesktop.DBus.Error.ServiceUnknown: The name io.snapcraft.Launcher was not provided by any .service files
Error org.freedesktop.DBus.Error.ServiceUnknown: The name com.canonial.SafeLauncher was not provided by any .service files
Is there a way to get this to work or do I need to change to xdg-open which I’ve seen should be able to be called from snap applications, even though it’s not as straight forward for end users as they have to install extra dependencies as far as I know.
Using xdg-open results in a permission denied error.
File "main.py", line 337, in __quitApplication
File "/usr/lib/python3.5/subprocess.py", line 947, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.5/subprocess.py", line 1551, in _execute_child
raise child_exception_type(errno_num, err_msg)
PermissionError: [Errno 13] Permission denied
I just checked, xdg-open is not in the resulting snap. Also I have not put it in the yaml file anywhere explicitly. So that should be fine.
Anything else that I can check?
I’m not sure what the permission is about. All I do at that time is subprocess.Popen(["xdg-open", self.website])
where website is a simple website URL either to my website or to an irc channel.
Sorry, I forgot there were recent changes around this. Access to xdg-open was just recently opened up as you can see in this conversation.
As an easy workaround, you can try copying the trivial xdg-open script in your snap for the time being, until this change goes live in an upcoming core snap. The script is just a shell line sending a message over DBus.
Please let us know how it goes, and I’m sorry for the trouble there.