Short-bus / pilomar

RaspberryPi based miniature observatory
https://shortbus.blog/
GNU General Public License v3.0
67 stars 14 forks source link

The Python code does not respect the RPi's locale setting by default. #36

Open Short-bus opened 10 months ago

Short-bus commented 10 months ago

Jérémie / (Bobleponge91) found that pilomar.py and libraries do not understand "," as a decimal separator within Python functions if the locale specifies that character. As a workaround the RPi's locale needs to be set to one with "." as the decimal character such as "UK/English". Is there anything simple which can be implemented to make the program more tolerant of other locales?

Short-bus commented 8 months ago

65rbeyer on Instructables reported the same problem with his build.

Traceback (most recent call last):
 File "pilomar.py", line 1206, in <module>
  SDCardMonitor = discmonitor(name='root',devname='/dev/root',path='/',disctype='boot',logger=MainLog.Log) # Create new disc space monitor for the SD card.
 File "/home/pi/pilomar/src/pilomardisc.py", line 54, in __init__
  self.Poll(force=True) # Kickstart the values.
 File "/home/pi/pilomar/src/pilomardisc.py", line 98, in Poll
  dfdict = self.GetDfDictionary()
 File "/home/pi/pilomar/src/pilomardisc.py", line 86, in GetDfDictionary
  v = int(float(v[:-1]) * ji[1]) # Convert from HR text value into absolute value.
ValueError: could not convert string to float: '4,2'