Skip to content

pymodbus.simulator does not start #1385

@chkr-private

Description

@chkr-private

Versions

  • Python: 3.10.9
  • OS: Fedora 36
  • Pymodbus: head of dev branch, commit 217469a

Description

  • start pymodbus.simulator, using the included setup.json file
  • stops with error message
pymodbus.simulator --json_file pymodbus/server/simulator/setup.json 
22:17:54 INFO  logging:74 Start simulator
Traceback (most recent call last):
  File "/usr/bin/pymodbus.simulator", line 33, in <module>
    sys.exit(load_entry_point('pymodbus==3.1.3', 'console_scripts', 'pymodbus.simulator')())
  File "/home/chkr/projects/pymodbus/pymodbus/server/simulator/main.py", line 118, in main
    asyncio.run(run_main(), debug=True)
  File "/usr/lib64/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib64/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/home/chkr/projects/pymodbus/pymodbus/server/simulator/main.py", line 112, in run_main
    task = ModbusSimulatorServer(**cmd_args)
  File "/home/chkr/projects/pymodbus/pymodbus/server/simulator/http_server.py", line 142, in __init__
    device, custom_actions_dict or None
UnboundLocalError: local variable 'custom_actions_dict' referenced before assignment

Comments

  • after I reverted that commit, the simulator started
  • however, the web GUI did not show any registers and I was unable to retrieve the values of any register or coil (probably I misinterpreted setup.json)
    • Should there be some data available with the default setup.json? Should the web GUI show some registers?
    • If yes, do you have an example how I can access them (e.g. via python.console)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions