Skip to content

IndexError: string index out of range #211

@dhoomakethu

Description

@dhoomakethu

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions