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

IndexError: string index out of range #211

Closed
dhoomakethu opened this issue Sep 1, 2017 · 1 comment
Closed

IndexError: string index out of range #211

dhoomakethu opened this issue Sep 1, 2017 · 1 comment

Comments

@dhoomakethu
Copy link
Contributor

dhoomakethu commented Sep 1, 2017

Once in a while pymodbus throw this error

File "/Users/sanjay/.virtualenvs/huduku/lib/python2.7/site-packages/pymodbus/client/sync.py", line 85, in execute
    return self.transaction.execute(request)
  File "/Users/sanjay/.virtualenvs/huduku/lib/python2.7/site-packages/pymodbus/transaction.py", line 150, in execute
    self.client.framer.processIncomingPacket(result, self.addTransaction)
  File "/Users/sanjay/.virtualenvs/huduku/lib/python2.7/site-packages/pymodbus/transaction.py", line 672, in processIncomingPacket
    self._process(callback, error=True)
  File "/Users/sanjay/.virtualenvs/huduku/lib/python2.7/site-packages/pymodbus/transaction.py", line 692, in _process
    result = self.decoder.decode(data)
  File "/Users/sanjay/.virtualenvs/huduku/lib/python2.7/site-packages/pymodbus/factory.py", line 223, in decode
    return self._helper(message)
  File "/Users/sanjay/.virtualenvs/huduku/lib/python2.7/site-packages/pymodbus/factory.py", line 245, in _helper
    response.decode(data[1:])
  File "/Users/sanjay/.virtualenvs/huduku/lib/python2.7/site-packages/pymodbus/pdu.py", line 189, in decode
    self.exception_code = byte2int(data[0])
IndexError: string index out of range

another one

File "/Users/sanjay/.virtualenvs/huduku/lib/python2.7/site-packages/pymodbus/client/sync.py", line 85, in execute
    return self.transaction.execute(request)
  File "/Users/sanjay/.virtualenvs/huduku/lib/python2.7/site-packages/pymodbus/transaction.py", line 150, in execute
    self.client.framer.processIncomingPacket(result, self.addTransaction)
  File "/Users/sanjay/.virtualenvs/huduku/lib/python2.7/site-packages/pymodbus/transaction.py", line 672, in processIncomingPacket
    self._process(callback, error=True)
  File "/Users/sanjay/.virtualenvs/huduku/lib/python2.7/site-packages/pymodbus/transaction.py", line 692, in _process
    result = self.decoder.decode(data)
  File "/Users/sanjay/.virtualenvs/huduku/lib/python2.7/site-packages/pymodbus/factory.py", line 223, in decode
    return self._helper(message)
  File "/Users/sanjay/.virtualenvs/huduku/lib/python2.7/site-packages/pymodbus/factory.py", line 245, in _helper
    response.decode(data[1:])
  File "/Users/sanjay/.virtualenvs/huduku/lib/python2.7/site-packages/pymodbus/register_read_message.py", line 87, in decode
    byte_count = byte2int(data[0])
IndexError: string index out of range
@dhoomakethu
Copy link
Contributor Author

Not reproducicble

ccatterina pushed a commit to ccatterina/pymodbus that referenced this issue Apr 17, 2018
If an incomplete response is received strange things happened
(e.g. receiving 0xFF raise an IndexError, receiving 0x011012
raise a struct.error).
Now if an incomplete response is received an error is logged.

Related to discussion in pymodbus-dev#188 , Fix pymodbus-dev#211
ccatterina pushed a commit to ccatterina/pymodbus that referenced this issue Apr 18, 2018
If an incomplete response is received strange things happened
(e.g. receiving 0xFF raise an IndexError, receiving 0x011012
raise a struct.error).
Now if an incomplete response is received an error is logged.

Related to discussion in pymodbus-dev#188 , Fix pymodbus-dev#211
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant