Page 1 sur 1

Python, dossier installation

Publié : 25 avr. 2018, 20:33
par Tonio16
Bonjour

J'ai un souci avec un plugin python que j'essaye d'écrire.
Quand je le lance, il me dit:
failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/Drexel/:/usr/lib/python35.zip:/usr/lib/python3.5:/usr/lib/python3.5/plat-arm-linux-gnueabihf:/usr/lib/python3.5/lib-dynload'.
2018-04-25 18:09:24.955 Error: (Test) Module Import failed, exception: 'ImportError'
2018-04-25 18:09:24.955 Error: (Test) Module Import failed: ' Name: minimalmodbus'
Je reinstalle Minimalmodubs avec pip3, qui le met alors dans: /usr/local/lib/python3.5/dist-packages

Je le déplace vers /usr/lib/python3.5/ plus de problème d'import mais cela me donne:
2018-04-25 18:43:18.300 Error: (test2) 'onHeartbeat' failed 'ValueError'.
2018-04-25 18:43:18.301 Error: (test2) ----> Line 93 in /home/pi/domoticz/plugins/Drexel/plugin.py, function onHeartbeat
2018-04-25 18:43:18.301 Error: (test2) ----> Line 64 in /home/pi/domoticz/plugins/Drexel/plugin.py, function onHeartbeat
2018-04-25 18:43:18.301 Error: (test2) ----> Line 325 in /usr/lib/python3.5/minimalmodbus.py, function read_long
2018-04-25 18:43:18.301 Error: (test2) ----> Line 697 in /usr/lib/python3.5/minimalmodbus.py, function _genericCommand
2018-04-25 18:43:18.301 Error: (test2) ----> Line 798 in /usr/lib/python3.5/minimalmodbus.py, function _performCommand
2018-04-25 18:43:18.301 Error: (test2) ----> Line 1075 in /usr/lib/python3.5/minimalmodbus.py, function _extractPayload
Comment faire pour installer proprement et au bon endroit (pour Domoticz) le module à importer. Peut-on indiquer le plugin le chemin pour minmalmodbus ?

Merci

Antoine

Re: Python, dossier installation

Publié : 07 mai 2018, 11:44
par papoo
il me semblait que le système de plugin ne fonctionnait qu'avec python3.4 (mais je peux me tromper)
as tu essayé
You can also manually download the compressed source files from https://pypi.python.org/pypi/MinimalModbus/ (see the end of that page). In that case you first need to manually install pySerial from https://pypi.python.org/pypi/pyserial.

There are compressed source files for Unix/Linux (.tar.gz) and Windows (.zip). To install a manually downloaded file, uncompress it and run (from within the directory):

python setup.py install
or possibly:

sudo python setup.py install
If using Python 3, then install with:

sudo python3 setup.py install
For Python3 there might be problems with easy_install and pip. In that case, first manually install pySerial and then manually install MinimalModbus.

To make sure it is installed properly, print the _getDiagnosticString() message. See the Support section for instructions.

You can also download the source directly from Linux command line:

wget https://pypi.python.org/packages/source ... 0.7.tar.gz
Change version number to the appropriate value.
http://minimalmodbus.readthedocs.io/en/ ... ation.html

Re: Python, dossier installation

Publié : 07 mai 2018, 12:56
par Tonio16
Ok, je vais approfondir ce point.

Merci

Antoine