I'm trying to figure out what is going on when the toonapilib is not found in domoticz.
So I deinstalled the toonapilib on my test VM running raspbian and restarted domoticz.
The log file show the error that it cannot find the toonapilib.
Code: Select all
2019-02-16 23:17:14.651 Error: (ToonApiLib) failed to load 'plugin.py', Python Path used was '/home/pi/dev-domoticz/plugins/toonapilib4domoticz/:/usr/lib/python35.zip:/usr/lib/python3.5:/usr/lib/python3.5/plat-i386-linux-gnu:/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-02-16 23:17:14.651 Error: (TestApilib) Module Import failed, exception: 'ImportError'
2019-02-16 23:17:14.651 Error: (TestApilib) Module Import failed: ' Name: toonapilib'
2019-02-16 23:17:14.651 Error: (TestApilib) Error Line details not available.
Then I installed toonapilib without sudo, thus with plain pi user rights.
Restarting domoticz service (
sudo domoticz restart) yields the same error:
Code: Select all
2019-02-16 23:27:24.267 Error: (ToonApiLib) failed to load 'plugin.py', Python Path used was '/home/pi/dev-domoticz/plugins/toonapilib4domoticz/:/usr/lib/python35.zip:/usr/lib/python3.5:/usr/lib/python3.5/plat-i386-linux-gnu:/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-02-16 23:27:24.267 Error: (TestApilib) Module Import failed, exception: 'ImportError'
2019-02-16 23:27:24.267 Error: (TestApilib) Module Import failed: ' Name: toonapilib'
2019-02-16 23:27:24.267 Error: (TestApilib) Error Line details not available.
I uninstalled toonapilib (
pip3 uninstall toonapilib). Notethat files were located in /home/pi/.local/lib/python3.5/site-packages/toonapilib/.
Now I installed toonapilib with admin rights:
sudo pip3 install toonapilib
Code: Select all
2019-02-16 23:30:56.325 Error: (ToonApiLib) failed to load 'plugin.py', Python Path used was '/home/pi/dev-domoticz/plugins/toonapilib4domoticz/:/usr/lib/python35.zip:/usr/lib/python3.5:/usr/lib/python3.5/plat-i386-linux-gnu:/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-02-16 23:30:56.325 Error: (TestApilib) Module Import failed, exception: 'SyntaxError'
2019-02-16 23:30:56.325 Error: (TestApilib) Import detail: File: /usr/local/lib/python3.5/dist-packages/toonapilib/helpers.py, Line: 26, offset: 17
2019-02-16 23:30:56.325 Error: (TestApilib) Error Line ' access_token: str
2019-02-16 23:30:56.325 '
This error shows when you do not use version 3.0.2 but 3.0.4 of toonapilib.
I suspect a compatibility issue with Python 3.5 that is installed on my environment.
But NOW, I install toonapilib once more, but force the 3.0.2 version:
sudo pip3 install toonapilib==3.0.2.
Toonapilib is located in /usr/local/lib/python3.5/dist-packages/toonapilib
Code: Select all
2019-02-16 23:42:56.588 (TestApilib) Creating Toon devices
No more errors...
This result was obtained while using Domoticz development version 4.1043.0.
I will check my Pi as well. But keep in mind: use
sudo pip3 install toonapilib to install the python library!
Update #1:
Just checked my Pi. I have created a symlink from the installed toonapilib to /usr/lib/python3.5/toonapilib:
sudo ln -s /usr/local/lib/python3.5/dist-packages/toonapilib /usr/lib/python3.5/toonapilib
If I remove the link, domoticz fails to import the plugin. After recreating the symlink, all is well.