0

I'm trying to learn and program using pyModbus. I have an example program which is running fine. It has this code to import the ModbusClient

from pyModbusTCP.client import ModbusClient

which works ok.

Now I'm trying to run and understand one the pyModbus website examples which has this code:

from pymodbus.constants import Endian
from pymodbus.client.sync import ModbusTcpClient
from pymodbus.payload import BinaryPayloadDecoder

This one throws an error on the first line

from pymodbus.constants import Endian ImportError: No module name pymodbus.constants

This is probably a naive user problem, as my experience with Python objects is weak. But can you help?...RDK

RDK
  • 355
  • 2
  • 7
  • 24
  • Could you try re-installing or upgrading `pymodbus` in your environment? Then, restart your program and try again – amanb Apr 07 '19 at 16:12
  • I only yesterday installed the pyModbus from the git site (https://github.com/sourceperl/pyModbusTCP) on to my Pi 3 running Debian Stretch. Trying to run on my Pi – RDK Apr 07 '19 at 18:29
  • I'm trying to run the "SunSpec client Example" (https://pymodbus.readthedocs.io/en/latest/source/example/sunspec_client.html) which fail on the import step – RDK Apr 07 '19 at 18:35
  • Sunspec client is outdated example and the git site you are referring Is not the official repo for pymodbus. Install the latest pymodbus with `pip install pymodbus -U` or clone it from the official repo `https://github.com/riptideio/pymodbus` .For using `Endian` use `from pymodbus.payload import Endian` – Sanju Apr 08 '19 at 17:15

0 Answers0