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

enumerations break on spaces #23

Open
smee opened this issue Oct 17, 2023 · 1 comment
Open

enumerations break on spaces #23

smee opened this issue Oct 17, 2023 · 1 comment

Comments

@smee
Copy link

smee commented Oct 17, 2023

Shouldn't

parts = line.split()
be splitlines? split will split on any whitespace, so this enumeration will not work:

:example 0=ok 1=not ok

Error message:

Traceback (most recent call last):
File "/home/pi/.local/bin/modbus", line 110, in
main()
File "/home/pi/.local/bin/modbus", line 101, in main
definitions.parse(args.registers + os.environ.get('MODBUS_DEFINITIONS', '').split(':'))
File "/home/pi/.local/lib/python3.9/site-packages/modbus_cli/definitions.py", line 25, in parse
self.parse_line(accumulated_line)
File "/home/pi/.local/lib/python3.9/site-packages/modbus_cli/definitions.py", line 40, in parse_line
name, values = self.parse_presenter(line)
File "/home/pi/.local/lib/python3.9/site-packages/modbus_cli/definitions.py", line 63, in parse_presenter
value, symbol = definition.split('=')
ValueError: not enough values to unpack (expected 2, got 1)

@favalex
Copy link
Owner

favalex commented Oct 17, 2023

Spaces in enum identifiers are not supported, you can use something like 1=not_ok or 1=ko instead.

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

No branches or pull requests

2 participants