Closed
Description
Versions
- Pymodbus: 3.8.0
Description
Previously, a timeout during a call to e.g. client.read_coils
would log an error and return an exception response. As of 3.8.0, this instead returns None
in the async client, which breaks the normal usage of PyModbus as given in the documentation:
try:
rr = await client.read_coils(1, 1, slave=1)
except ModbusException as exc:
_logger.error(f"ERROR: exception in pymodbus {exc}")
raise exc
if rr.isError(): # Error: NoneType has attribute 'isError'.
_logger.error("ERROR: pymodbus returned an error!")
raise ModbusException(txt)
This can be seen by comparing TransactionManager
's sync_execute
:
txt = f"No response received after {self.retries} retries, continue with next request"
Log.error(txt)
raise ModbusIOException(txt)
with execute
:
Log.error(f"No response received after {self.retries} retries, continue with next request")
self.response_future = asyncio.Future()
return None
Metadata
Metadata
Assignees
Labels
No labels