Error in ZaehlerstandClass.py
Closed this issue · 2 comments
My config:
[AnalogReadOut]
#If enabled analog counters will be read, if disabled only digital counters will be read.
Enabled=False
[PreValue]
time = 2000-01-01_00-00-00
lastvorkomma = 0000
lastnachkomma = 0000
After success reading, I got the error in:
ZaehlerstandClass.py
def prevalueStoreToFile(self, logtime):
config = configparser.ConfigParser()
config.read('./config/prevalue.ini')
config['PreValue']['LastVorkomma'] = self.LastVorkomma
config['PreValue']['LastNachkomma'] = self.LastNachkomma
config['PreValue']['Time'] = logtime
with open('./config/prevalue.ini', 'w') as cfg:
config.write(cfg)
The expected value is not a string.
Traceback (most recent call last):
File "./wasseruhr.py", line 111, in do_GET
result = wasserzaehler.getZaehlerstand(url, simple, usePrevalue, single)
File "/lib/ZaehlerstandClass.py", line 167, in getZaehlerstand
self.UpdateLastValues(error)
File "/lib/ZaehlerstandClass.py", line 312, in UpdateLastValues
self.prevalueStoreToFile(logtime)
File "/lib/ZaehlerstandClass.py", line 101, in prevalueStoreToFile
config['PreValue']['LastNachkomma'] = self.LastNachkomma
File "/usr/local/lib/python3.7/configparser.py", line 1255, in setitem
self._parser._validate_value_types(option=key, value=value)
File "/usr/local/lib/python3.7/configparser.py", line 1182, in _validate_value_types
raise TypeError("option values must be strings")
TypeError: option values must be strings