Unsupported locale setting

my app works fine on the localhost but when deployed on streamlit sharing throws the following error,

Error: unsupported locale setting

Traceback:

File "/home/appuser/.local/lib/python3.7/site-packages/streamlit/script_runner.py", line 332, in _run_script
    exec(code, module.__dict__)File "/app/web-apps/Webapp.py", line 31, in <module>
    locale.setlocale(locale.LC_ALL, 'de_DE')File "/usr/local/lib/python3.7/locale.py", line 608, in setlocale
    return _setlocale(category, locale)

I need the locale ‘de_DE’ in order to show thousands separeted by points instead of commas.

Hi @m-hammaad -

Can you provide a link to your repo, so that I can try to reproduce this?

Best,
Randy

Hi @randyzwitch,

using “german” as the locale setting produces a similar / the same error:

Error: unsupported locale setting

Traceback:

File "/usr/local/lib/python3.7/site-packages/streamlit/script_runner.py", line 332, in _run_script
    exec(code, module.__dict__)File "/app/covid_dashboard/app.py", line 8, in <module>
    locale.setlocale(locale.LC_ALL, "german")File "/usr/local/lib/python3.7/locale.py", line 608, in setlocale
    return _setlocale(category, locale)

Here is the link to my repo: GitHub - tlary/covid_dashboard

Best,
Tobias

Hi @tlary, welcome to the Streamlit community! I submitted a PR to your package, and German should now be your default.

@m-hammaad, you can do the following:

  • Create a packages.txt file and add the line locales-all
  • Make sure your Python code is the following:
import locale
locale.setlocale(locale.LC_ALL, "de_DE")

Best,
Randy

1 Like

Thanks @randyzwitch, it works perfectly! :slight_smile:

Keep up the great work!

1 Like