ljean / modbus-tk

Create Modbus app easily with Python
Other
569 stars 213 forks source link

data gets lost by logger #144

Open gicking opened 3 years ago

gicking commented 3 years ago

hi,

I have a small network of Arduinos controlled via RS485 and Modbus-RTU. The setup is working correctly, and registers can be written and read as expected. However, it seems that the logging function seems to prevent data from (at least) READ_INPUT_REGISTERS from being returned. Specifically:

result = master.execute(id, cst.READ_INPUT_REGISTERS, 0, 1)
print(result)

prints the expected register content, but

result = logger.info(id, cst.READ_INPUT_REGISTERS, 0, 1))
print(result)

prints None. Debugger also shown that nothing is returned. Short term solution is to delete logging completely, but I would really like to keep the logger in case of problems. Attached please find a minimal_example (change extension to .py). Any idea what I do wrong?

OS: Linux (Ubuntu 18.04) Python: 3.6 modbus-tk: 1.1.2 pyserial: 3.5