This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: gettext.translations crashes when locale is unset
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.8
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: amazingminecrafter2015, lys.nikolaou, terry.reedy
Priority: normal Keywords:

Created on 2022-02-13 01:33 by amazingminecrafter2015, last changed 2022-04-11 14:59 by admin.

Messages (2)
msg413151 - (view) Author: unmellow the gamer (amazingminecrafter2015) Date: 2022-02-13 01:33
The issue listed below contains an example of this problem
I assume python programs crashing when an environment variable is unset
is unintended and thought after all this time i should probably bring it to your attention
https://github.com/k4yt3x/video2x/issues/349
msg413508 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2022-02-18 20:13
As 'crash', as used here, is when python exits abnormally *without* an exception traceback.  The traceback in the linked report is:

Traceback (most recent call last):
  File "video2x.py", line 53, in <module>
    from upscaler import AVAILABLE_DRIVERS
  File "/home/meltonmb/video2x-4.6.1/src/upscaler.py", line 48, in <module>
    language = gettext.translation(DOMAIN, LOCALE_DIRECTORY, [default_locale], fallback=True)
  File "/usr/lib/python3.8/gettext.py", line 583, in translation
    mofiles = find(domain, localedir, languages, all=True)
  File "/usr/lib/python3.8/gettext.py", line 554, in find
    for nelang in _expand_lang(lang):
  File "/usr/lib/python3.8/gettext.py", line 213, in _expand_lang
    loc = locale.normalize(loc)
  File "/usr/lib/python3.8/locale.py", line 401, in normalize
    code = localename.lower()
AttributeError: 'NoneType' object has no attribute 'lower'

Whether the bug is in the 3rd party module 'upscaler' or the stdlib module gettext depends on whether the DOMAIN, LOCALE_DIRECTORY, and [default_locale] arguments in upscaler's call to gettext.translation meet the documented requirements.  What are their values?
History
Date User Action Args
2022-04-11 14:59:56adminsetgithub: 90891
2022-02-18 20:13:14terry.reedysetnosy: + terry.reedy
messages: + msg413508
2022-02-14 04:09:32eric.smithsettype: crash -> behavior
components: + Library (Lib), - Parser
2022-02-13 14:31:05pablogsalsetnosy: - pablogsal
2022-02-13 01:33:53amazingminecrafter2015create