bvanheu / pytoutv

TOU.TV client library and user interfaces written in Python 3
96 stars 23 forks source link

locale.Error: unsupported locale setting #112

Closed Higashifukai closed 7 years ago

Higashifukai commented 7 years ago

Hi, I works perfectly on my Mac, but I get the following error on a Raspberry pi (Rasbian):

pi@raspberrypi:~ $ toutv list Traceback (most recent call last): File "/usr/local/bin/toutv", line 11, in sys.exit(run()) File "/usr/local/lib/python3.4/dist-packages/toutvcli/app.py", line 835, in run return app.run() File "/usr/local/lib/python3.4/dist-packages/toutvcli/app.py", line 76, in run locale.setlocale(locale.LC_ALL, '') File "/usr/lib/python3.4/locale.py", line 592, in setlocale return _setlocale(category, locale) locale.Error: unsupported locale setting

Higashifukai commented 7 years ago

Here is my locale: pi@raspberrypi:~ $ locale locale: Cannot set LC_CTYPE to default locale: No such file or directory locale: Cannot set LC_ALL to default locale: No such file or directory LANG=en_GB.UTF-8 LANGUAGE= LC_CTYPE=UTF-8 LC_NUMERIC="en_GB.UTF-8" LC_TIME="en_GB.UTF-8" LC_COLLATE="en_GB.UTF-8" LC_MONETARY="en_GB.UTF-8" LC_MESSAGES="en_GB.UTF-8" LC_PAPER="en_GB.UTF-8" LC_NAME="en_GB.UTF-8" LC_ADDRESS="en_GB.UTF-8" LC_TELEPHONE="en_GB.UTF-8" LC_MEASUREMENT="en_GB.UTF-8" LC_IDENTIFICATION="en_GB.UTF-8" LC_ALL=

simark commented 7 years ago

That's probably because your selected locale is not enabled. Is en_GB.UTF-8 commented out in /etc/locale.gen? If so, de-comment it (remove the leading #) and run locale-gen.

If you want to select another locale than en_GB.UTF-8, you can follow this: http://www.irrational.net/2012/04/18/making-the-raspberry-pi-less-british/

Higashifukai commented 7 years ago

Hi simark, en_GB.UTF-8 was already de-commented. I finally solved the problem with: export LC_ALL="en_GB.UTF-8" export LC_CTYPE="GB_US.UTF-8" sudo dpkg-reconfigure locales

Thank you for your help.

simark commented 7 years ago

Ok, good to know. It's weird that they wouldn't be defined by default. I am closing the issue, feel free to re-open if needed.