LoveBootCaptain / WeatherPi_TFT

a weather display for a raspberry pi and a TFT display written in python3 and pygame
Other
80 stars 24 forks source link

Problems with Python3.7 and #6

Closed HWHardsoft closed 4 years ago

HWHardsoft commented 4 years ago

Hi, I want to use your weather station code but when I try to start the code under Python 3.7 I will get an error - see attached picture.

grafik

Localisation is set to UTF-8 and 'de' for Germany. What can I do?

Thx for your help

HWHardsoft commented 4 years ago

solved!!! locale.setlocale(locale.LC_ALL, '') works fine!

LoveBootCaptain commented 4 years ago

i will check that again when i get my new RPI zero W ;) will fix it in the open feature branch if still fix needed. I'm currently have to disable that line on my dev maschine since this command does not work on mac os. this line is needed to localize the date strings for weekdays. i think your fix will always fallback to the default configured locale? right? if i might remember correct this made issues when someone has more than one locale configured in their os. a guy from china pointed me once on that... but I'm unsure cause it's long ago.

LoveBootCaptain commented 4 years ago

Hi again,

i checked again... it is working in 3.7.x with locale.setlocale(locale.LC_ALL, locale.getdefaultlocale())

you have to setup a valid UTF-8 default locale on the Pi with sudo raspi-config

on a local maschine i have to use locale.setlocale(locale.LC_ALL, ('de_DE', 'UTF-8'))

locale is always a tuple, so it is not enough to set it to 'de' only.

check the current /development branch... there i introduced a switch for local development and production mode by setting an extra env-variable in config.json

will close this one cause i can't reproduce