I have a snap written in python 3. I’d like to provide a button to allow users to uninstall the app from inside itself. On button-click, how can I get the app to self-uninstall?
I know the terminal way of doing things:
sudo snap remove <my-snap-name>
I could call that from python like so:
subprocess.call('sudo snap remove <my-snap-name>', shell=True)
But that code only works when the user has sudo privileges, and these are just regular users. Not positive what user the snap is actually running as, but it isn’t sudo.
I tried using this library:
…but when I called it like so:
…I got the following error message:
[Errno 13] Permission denied
Apparently I don’t have permission to ask for permission. LOL
Is there another way to uninstall the snap provided by snapcraft? Or is there a way to launch an elevated privileges window gui to establish sudo permissions for the regular user?