Hi all,
I am using Python version 3.6.15 on a Raspi4 with Leap 15.4.
Since Sunday, likely after an update I have a problem when running a python
module which is embedded in a larger system.
The piece of code is:
if name in moduleData:
if self.debugMode:
self.logMessage('moduleData[name]: '+moduleData[name]+" point"\
+name+': '+str(valDouble))
a = moduleData[name].split("+")
b = a[1].split(":")
c = a[0].split(".")
#self.logMessage('a[0]='+str(a[0]))
if len(c) > 1 :
pT = datetime.strptime(str(a[0]),"%Y-%m-%dT%H:%M:%S.%f")
else :
pT = datetime.strptime(str(a[0]),"%Y-%m-%dT%H:%M:%S")
In debug mode the output of the third line from this piece of code gives:
2022-10-27 16:11:59.236 Zonnepanelen: moduleData[name]:
2022-10-27T16:10:54.458+02:00 point electricity_point_meter: -134.66
which means that moduleData[name] contains: 2022-10-27T16:10:54.458+02:00
So the elements of a, b and c all of type str.
The error message I get is:
2022-10-27 14:45:34.221 Zonnepanelen: Exception caught :attribute of type
'NoneType' is not callableTraceback (most recent call last):
File "/usr/share/domoticz/plugins/PlugwiseStretch/plugin.py", line 262, in
onHeartbeat
pT = datetime.strptime(str(a[0]),"%Y-%m-%dT%H:%M:%S.%f")
TypeError: attribute of type 'NoneType' is not callable
This NoneType message makes no sense to me.
Above that, when I remove the # in front of line 8 of this piece of code I get
an error message at compile time:
Error Line ' self.logMessage('a[0]='+str(a[0]))
This does not make sense to me either; it has the same construction as in line
3 of this piece of code, which works and get compiled.
Any suggestions? Should I use python 3.10?
--
fr.gr.
member openSUSE
Freek de Kruijf