Skip to content

Crash when attempting to add holding registers or input registers #7

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

Closed
programatt opened this issue Dec 17, 2018 · 6 comments
Closed

Comments

@programatt
Copy link
Contributor

  • OSX 10.14.1
  • Python 3.7
  • pip list

Package Version


Click 7.0
Cython 0.29.2
docutils 0.13.1
Kivy 1.10.1
Kivy-Garden 0.1.4
pip 18.1
pygame 1.9.4
pyglet 1.2.4
Pygments 2.1.3
pymodbus 2.1.0
pyserial 3.4
requests 2.12.4
setuptools 39.0.1
six 1.11.0

Clicking the add button for adding input registers or holding registers crashes the app with the following trace.

[INFO ] [Base ] Leaving application in progress... Traceback (most recent call last): File "/Users/matt/code/modbus-simulator/modbus_simulator/main.py", line 27, in <module> _run() File "/Users/matt/code/modbus-simulator/venv/lib/python3.7/site-packages/click/core.py", line 764, in __call__ return self.main(*args, **kwargs) File "/Users/matt/code/modbus-simulator/venv/lib/python3.7/site-packages/click/core.py", line 717, in main rv = self.invoke(ctx) File "/Users/matt/code/modbus-simulator/venv/lib/python3.7/site-packages/click/core.py", line 956, in invoke return ctx.invoke(self.callback, **ctx.params) File "/Users/matt/code/modbus-simulator/venv/lib/python3.7/site-packages/click/core.py", line 555, in invoke return callback(*args, **kwargs) File "/Users/matt/code/modbus-simulator/modbus_simulator/main.py", line 23, in _run run() File "/Users/matt/code/modbus-simulator/modbus_simulator/ui/gui.py", line 1219, in run ModbusSimuApp().run() File "/Users/matt/code/modbus-simulator/venv/lib/python3.7/site-packages/kivy/app.py", line 826, in run runTouchApp() File "/Users/matt/code/modbus-simulator/venv/lib/python3.7/site-packages/kivy/base.py", line 502, in runTouchApp EventLoop.window.mainloop() File "/Users/matt/code/modbus-simulator/venv/lib/python3.7/site-packages/kivy/core/window/window_sdl2.py", line 727, in mainloop self._mainloop() File "/Users/matt/code/modbus-simulator/venv/lib/python3.7/site-packages/kivy/core/window/window_sdl2.py", line 460, in _mainloop EventLoop.idle() File "/Users/matt/code/modbus-simulator/venv/lib/python3.7/site-packages/kivy/base.py", line 340, in idle self.dispatch_input() File "/Users/matt/code/modbus-simulator/venv/lib/python3.7/site-packages/kivy/base.py", line 325, in dispatch_input post_dispatch_input(*pop(0)) File "/Users/matt/code/modbus-simulator/venv/lib/python3.7/site-packages/kivy/base.py", line 291, in post_dispatch_input wid.dispatch('on_touch_up', me) File "kivy/_event.pyx", line 707, in kivy._event.EventDispatcher.dispatch File "/Users/matt/code/modbus-simulator/venv/lib/python3.7/site-packages/kivy/uix/behaviors/button.py", line 179, in on_touch_up self.dispatch('on_release') File "kivy/_event.pyx", line 703, in kivy._event.EventDispatcher.dispatch File "kivy/_event.pyx", line 1214, in kivy._event.EventObservers.dispatch File "kivy/_event.pyx", line 1098, in kivy._event.EventObservers._dispatch File "/Users/matt/code/modbus-simulator/venv/lib/python3.7/site-packages/kivy/lang/builder.py", line 64, in custom_callback exec(__kvlang__.co_value, idmap) File "/Users/matt/code/modbus-simulator/modbus_simulator/templates/modbussimu.kv", line 256, in <module> on_release: root.update_data_models(*args) File "/Users/matt/code/modbus-simulator/modbus_simulator/ui/gui.py", line 536, in update_data_models self._update_data_models(active, tab, value) File "/Users/matt/code/modbus-simulator/modbus_simulator/ui/gui.py", line 565, in _update_data_models self.update_backend(int(active), current_tab, list_data) File "/Users/matt/code/modbus-simulator/modbus_simulator/ui/gui.py", line 695, in update_backend v['formatter'] File "/Users/matt/code/modbus-simulator/modbus_simulator/utils/pymodbus_server.py", line 268, in encode getattr(builder, add_method)(value) File "/Users/matt/code/modbus-simulator/venv/lib/python3.7/site-packages/pymodbus/payload.py", line 177, in add_16bit_uint self._payload.append(pack(fstring, value)) struct.error: required argument is not an integer

@dhoomakethu
Copy link
Collaborator

Thanks for the report. Looks like the file is edited , the line number in the stack trace File "/Users/matt/code/modbus-simulator/modbus_simulator/ui/gui.py", line 695, in update_backend v['formatter'] doesn't match with code on the master (https://github.com/riptideio/modbus-simulator/blob/master/modbus_simulator/ui/gui.py#L690).

@dhoomakethu
Copy link
Collaborator

Looks like it is indeed an issue on python3, the problem is with the pymodbus package. The simulation works just fine on python2. Thanks for the report.

@programatt
Copy link
Contributor Author

@dhoomakethu yeah I tried putting in some code above it to try and diagnose it and the stack trace i copied must have been after that. I went back and tried it on master with 3.7 and still got the same error the line number was different.

@dhoomakethu
Copy link
Collaborator

The simulator is not python3 compatible, I have a local branch with python3 compatibility but not tested yet. If you could give a try and feedback, I can push the branch upstream.

@dhoomakethu
Copy link
Collaborator

Here is the branch

@dhoomakethu
Copy link
Collaborator

Fix now merged to master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants