Hi,
I get this error : Error: (Controler) 'onMessage' failed 'NameError'. But I can retrieve the name that make this error.
In a python, the name usually follow the error. How could I bring up the faulty name ?
Error Python : Return name Error Topic is solved
Moderator: leecollings
Error Python : Return name Error
Last edited by St7ven on Wednesday 29 March 2017 16:55, edited 1 time in total.
- Dnpwwo
- Posts: 820
- Joined: Sunday 23 March 2014 9:00
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Melbourne, Australia
- Contact:
Re: Error Python : Return name Error
@St7ven,
The Python framework will return all the information it can but sometimes Python does not make a traceback or the details available.
I would suggest added an error handler something like this around your onMessage function:a construct like that has given me more detail and may help you out.
The 'raise' at the end will pass the error back to Domoticz.
The Python framework will return all the information it can but sometimes Python does not make a traceback or the details available.
I would suggest added an error handler something like this around your onMessage function:
Code: Select all
def onMessage(self, Data, Status, Extra):
strData = Data.decode("utf-8", "ignore")
try:
...your code here...
except Exception as inst:
Domoticz.Error("Exception in onMessage, called with Data: '"+str(strData)+"'")
Domoticz.Error("Exception detail: '"+str(inst)+"'")
raise
The 'raise' at the end will pass the error back to Domoticz.
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
Re: Error Python : Return name Error
Thank you Dnpwwo,
It helps a lot !
It helps a lot !
Who is online
Users browsing this forum: No registered users and 1 guest