Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simulator server cannot start in current dev branch #1662

Closed
fhydralisk opened this issue Jul 18, 2023 · 0 comments · Fixed by #1663
Closed

Simulator server cannot start in current dev branch #1662

fhydralisk opened this issue Jul 18, 2023 · 0 comments · Fixed by #1663

Comments

@fhydralisk
Copy link
Contributor

Versions

  • Python: 3.9
  • OS: macos 13.4
  • Pymodbus: dev-3.4.0
  • Modbus Hardware (if used): None

Pymodbus Specific

  • Server: tcp, simulator
  • Client: None

Description

When I was trying to start a simulator by running main.py in server/simulator/, python complained with error logs below:

pymodbus $ PYTHONPATH=. python server/simulator/main.py
2023-07-18 09:23:23,159 INFO  logging:96 Start simulator
Executing <Task finished name='Task-1' coro=<run_main() done, defined at /Users/hydra/Documents/coding/pymodbus/pymodbus/server/simulator/main.py:112> exception=TypeError("__init__() got an unexpected keyword argument 'loop'") created at /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py:621> took 0.118 seconds
Traceback (most recent call last):
  File "xxx/pymodbus/server/simulator/main.py", line 125, in <module>
    main()
  File "xxx/pymodbus/server/simulator/main.py", line 121, in main
    asyncio.run(run_main(), debug=True)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "xxx/pymodbus/server/simulator/main.py", line 115, in run_main
    task = ModbusSimulatorServer(**cmd_args)
  File "xxx/pymodbus/server/simulator/http_server.py", line 168, in __init__
    self.modbus_server = comm(framer=framer, context=datastore, **server)
TypeError: __init__() got an unexpected keyword argument 'loop'

I've digged into the commit logs of pymodbus and found that class ModbusTcpServer in pymodbus/server/async_io.py was originally accepting a **kwargs value in init which is removed in current dev branch. If I'm right I think **kwargs should be added back, or the "loop" args in http_server.py L152 server["loop"] = asyncio.get_running_loop() should be removed.

fhydralisk added a commit to fhydralisk/pymodbus that referenced this issue Jul 18, 2023
fhydralisk added a commit to fhydralisk/pymodbus that referenced this issue Jul 18, 2023
janiversen pushed a commit that referenced this issue Jul 18, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant