Short-bus/pilomar

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

Opened this issue · 1 comments

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?

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'