Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WeatherPiTFT.py locale.Error: unsupported locale setting #42

Open
ghunter717 opened this issue Feb 13, 2021 · 2 comments
Open

WeatherPiTFT.py locale.Error: unsupported locale setting #42

ghunter717 opened this issue Feb 13, 2021 · 2 comments

Comments

@ghunter717
Copy link

ghunter717 commented Feb 13, 2021

Hi Captain

Have tried everything.
But unable to get the python script to recognise the file LC_ALL.

get this error
pygame 1.9.4.post1
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
File "/media/pi/rootfs/home/pi/WeatherPi_TFT/WeatherPiTFT.py", line 85, in
locale.setlocale(locale.LC_ALL, (config['LOCALE']['ISO'], 'UTF-8'))
File "/usr/lib/python3.7/locale.py", line 604, in setlocale
return _setlocale(category, locale)
locale.Error: unsupported locale setting

/etc/default/locale contains the following.

LC_ALL=en_GB.UTF-8
LANG=en_GB

I have read both closed items
#6

and

#1

I am in the UK.
also if i try to set my postal code in the config.json
Uk uses alpha numeric postal codes...
mine is SO302SX, the script errors.
Can you please advise what i am doing wrong.

Many thanks

Perhaps I should add I am using a Raspberry pi 0 W. with San Disk Ultra PLUS 32GB memory.
I have tried Reformatting the card and reloading the image using RASPI Imager several times. I am using Putty SSH to edit.
@LoveBootCaptain

@ghunter717
Copy link
Author

ghunter717 commented Feb 21, 2021

I have resolved the problems.

here is what I found and actioned.

  1. Used sudo raspi-config and set only en_GB for ISO-8859-1
  2. Python 3.7 In WeatherPiTFT.py tagged out line #locale.setlocale(locale.LC_ALL, (config['LOCALE']['ISO'], 'UTF-8'))
  3. added line locale.setlocale(locale.LC_ALL, locale.getdefaultlocale())
  4. set country to "uk" NOT "gb" in cd WeatherPi_TFT config.json with sudo nano
  5. corrected postal code to "SO30 2SX" in cd WeatherPi_TFT config.json with sudo nano the " " are missing in the downloaded package.

@LoveBootCaptain
Copy link
Owner

Hi there and sorry for my very very late reply.

The pandemic moved my focus away from this... But that does not mean the project is dead. 😁

I will try to use your information based on that topic on the next update I'm planning.

From my side I never got it working with an ISO locale... Only with UTF-8, which should be default on any Raspbian installation. Even the locale for GB should be default.

I never touched anything on the default locale settings and was able to start the app with default location data (Berlin) but english langues settings. Never found an issue on that...

Did you use a windows PC to set everything up? I could remember that @HWHardsoft also used an ISO locale cause for him UTF-8 didn't worked for German location and German langues settings... Which confused me (and still does)... I'm only using Mac OS and Linux systems to set everything up and even for development I never touched windows... Just a blind guess... But maybe that could cause an issue.

Thanks for pointing me to the issue with alphanumeric postal codes...

In Germany we only use digits, so I didn't add "..." to that value... python internally interprets that as an integer without the "..."

This is an easy fix what you've suggested and I will add a Bugfix to the next release.

Cheers and kind regards from Berlin
Stephan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants