Locale bug in my snap package or the Python program code itself?

Hi all,

I’m building my first ever snap, for Rapid Photo Downloader. I am the developer of this program. I am getting a runtime error in the snapped Rapid Photo Downloader. Although the program uses Python3 and Qt5, translation is done with gettext. For each process instantiation, one of the earliest tasks is thus:

import locale
# Use the default locale as defined by the LANG variable
locale.setlocale(locale.LC_ALL, '')

This generates an exception when running in the snap:

locale.Error: unsupported locale setting

Does that indicate my snap package is missing some packages to install, or that my Python code is doing something wrong?

And on a different topic, what is the definitive way for the program to know it is running inside a snap? I’d like to be able to turn off upgrade notifications when it is inside the snap.

Edit: should have mentioned the snap file is here:


Thanks in advance for any help,

Hi! I am personally looking forward to seeing this snap come to be!

I don’t think you are doing anything wrong with your locale logic, but I will have to get back to you on that one.

For in-snap detection, you can do something like this:

def is_snap() -> bool:
    snap_name = os.getenv("SNAP_NAME", "")
    return snap_name == "rapid-photo-downloader"

there is

but this comes from a time where we still had remote parts so re-working that a bit to become a local part is probably needed.

I added a stage-package locales-all. That may have solved the problem. I noticed this package from the qt5 desktop launcher code, some of which is not applicable for my code because that seems geared to C++ code.