emontnemery / domoticz_mqtt_discovery

MQTT discovery plugin for Domoticz
MIT License
40 stars 28 forks source link

Failed to load Plugin.py (Raspberry pi) #16

Closed meden199 closed 4 years ago

meden199 commented 5 years ago

I replaced a old script that was working with the new one. After replacing the plugin.py the plugin is not working anymore.

I found in the domoticz log:

MQTTDiscovery) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/domoticz_mqtt_discovery/:/usr/lib/python35.zip:/usr/lib/python3.5:/usr/lib/python3.5/plat-arm-linux-gnueabihf:/usr/lib/python3.5/lib-dynload:/usr/local/lib/python3.5/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.5/dist-packages'.

Any idea to solv my problem?

emontnemery commented 5 years ago

Which version of domoticz are you using? Do you by any chance have the previous version of the plugin?

meden199 commented 5 years ago

Domoticz version: Version: 4.10619

I restored my old plugin. for safe I renamed it to .old instead overwriting the file

emontnemery commented 5 years ago

OK, great!

Can you paste working and non working versions to pastebin or similar and link here?

meden199 commented 5 years ago

MQTT-Discovery.zip

plugin.py=working plugin.new=not working

emontnemery commented 5 years ago

@meden199 The plugin.new version has some white space error:

def DumpMQTTMessageToLog(topic, rawmessage, prefix=''):
    message = rawmessage.decode('utf8','replace')
    message = str(message.encode('unicode_escape'))
Domoticz.Log(prefix+topic+":"+message) # Incorrect indentation here

From where did you get this bad version? Or could it be caused by some manual edit/ copy&paste?

meden199 commented 5 years ago

Sorry for the delay. Yesterday we had kingsday in Holland, that means party :-)

First time i downloaded the .py from herer Second time was copy / paste

Today I updated my domoticz to a new beta version: 4.10631 and placed the .py in the folder. After rebooting domoticz the plugin is not visible in the plugin list and in the log:

Error: (MQTTDiscovery) failed to load 'plugin.py', Python Path used was ':/usr/lib/python35.zip:/usr/lib/python3.5:/usr/lib/python3.5/plat-arm-linux-gnueabihf:/usr/lib/python3.5/lib-dynload:/usr/local/lib/python3.5/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.5/dist-packages'. 2019-04-28 10:50:37.528 Error: (Homey) Module Import failed, exception: 'ImportError' 2019-04-28 10:50:37.528 Error: (Homey) Module Import failed: ' Name: plugin' 2019-04-28 10:50:37.529 Error: (Homey) Error Line details not available.