Strange error message when using the simulator server? #1501
-
Could be worth an issue but I'm not sure. When using the ModbusSimulatorServer I appear to get an error internal to the package regarding a missing log file. This file is supposedly meant to exist inside the PyModbus package itself from what I can tell, which means I'm stuck for being able to fix this locally. Could someone please confirm that I'm running the simulator correctly and whether this issue is actually of the package? Thanks. Here is the code I'm running with a pretty standard setup in the setup json file:
I have tried different settings for the kwarg log_file too and found no success. Kind of at a loss, think it may be a package issue where the open() needs to create the log file if it does not exist. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Seems it cannot open your config file. The handling is changed on dev, so it might be worth while to test with dev. |
Beta Was this translation helpful? Give feedback.
-
I'm not sure it is to do with the config file. The open() statement it's referencing occurs in the init function for the ModbusSimulatorServer class:
I ran a test on the dev branch of the repo and you're right it didn't throw the same error, though the handling I show above where the error occurs seems to actually be the same so I'm a little baffled. As a relevant side, is this class actually not meant to be used? The example 'server_simulator.py' instantiates simulator contexts but actually uses the StartAsyncTcpServer function to start it. Is this the recommended way? I've been struggling to follow the examples/docs and make a simulator for a modbus so I can test against it in a test suite. |
Beta Was this translation helpful? Give feedback.
-
and just to make it easy, we have included a main ready to run in pymodbus/server/simulator/main.py which can be started from the command line as pymodbus.simulator so we did not provide extra examples. |
Beta Was this translation helpful? Give feedback.
and just to make it easy, we have included a main ready to run in pymodbus/server/simulator/main.py
which can be started from the command line as pymodbus.simulator
so we did not provide extra examples.