Muzer / python-xbee

Automatically exported from code.google.com/p/python-xbee
MIT License
0 stars 0 forks source link

IndexError for misshaped packets #36

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Had the receiver running, the error appeared roughly after a week of use

What is the expected output? What do you see instead?
Nothing - the erroneous packet is discarded

What version of the product are you using? On what operating system?
Raspian

Please provide any additional information below.

My assumption is that there should be an extra check if there even is anything 
in the data. Possibly this is a very unusual situation which is caused by the 
middleware used.

Unhandled Error
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/twisted/python/log.py", line 84, in callWithLogger
    return callWithContext({"system": lp}, func, *args, **kw)
  File "/usr/lib/python2.7/dist-packages/twisted/python/log.py", line 69, in callWithContext
    return context.call({ILogContext: newCtx}, func, *args, **kw)
  File "/usr/lib/python2.7/dist-packages/twisted/python/context.py", line 118, in callWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
  File "/usr/lib/python2.7/dist-packages/twisted/python/context.py", line 81, in callWithContext
    return func(*args,**kw)
--- <exception caught here> ---
  File "/usr/lib/python2.7/dist-packages/twisted/internet/posixbase.py", line 586, in _doReadOrWrite
    why = selectable.doRead()
  File "/usr/lib/python2.7/dist-packages/twisted/internet/_posixserialport.py", line 62, in doRead
    return fdesc.readFromFD(self.fileno(), self.protocol.dataReceived)
  File "/usr/lib/python2.7/dist-packages/twisted/internet/fdesc.py", line 94, in readFromFD
    callback(output)
  File "/usr/lib/python2.7/dist-packages/twisted/protocols/basic.py", line 572, in dataReceived
    return self.rawDataReceived(data)
  File "/home/pi/open-zb-home/xbeeService/protocol.py", line 23, in rawDataReceived
    return getattr(self, "handle_packet", None)(self._split_response(self.frame.data))
  File "/home/pi/open-zb-home/xbee/base.py", line 205, in _split_response
    packet_id = data[0]
exceptions.IndexError: string index out of range

Original issue reported on code.google.com by klus.p...@gmail.com on 9 Nov 2012 at 3:58

GoogleCodeExporter commented 9 years ago
Hi klus.petr,

Thanks for reporting this issue. Which version of the library did you encounter 
this problem with?

Original comment by pmalms...@gmail.com on 9 Nov 2012 at 5:46

GoogleCodeExporter commented 9 years ago
I think I am using the latest one - any way to find out? I've checked the 
__init__.py  and cannot find any useful version information.

Original comment by klus.p...@gmail.com on 15 Nov 2012 at 2:19

GoogleCodeExporter commented 9 years ago
My apologies for the delay in getting back to you; I must have lost the email.

How did you install python-xbee? The posted distributions on PYPI and in the 
downloads sections here are rather out of date. 

It's likely that this issue has already been fixed in the latest code available 
here: http://code.google.com/p/python-xbee/source/browse/ (there's a link to 
download a zip file in the middle of the top navigation bar).

Original comment by pmalms...@gmail.com on 4 Jan 2013 at 4:27

GoogleCodeExporter commented 9 years ago
Thank you very much for your reply.

I actually did not install the xbee module, it came as a part of another 
project - so I suspect it may be quite outdated. I did not have much problem 
since, however, I will probably get myself properly up to date with latest 
release� and I will report how it went!

Original comment by klus.p...@gmail.com on 17 Jan 2013 at 4:44

GoogleCodeExporter commented 9 years ago
Any luck solving your problem? I am thinking of closing this issue.

Original comment by pmalms...@gmail.com on 14 Apr 2013 at 6:52

GoogleCodeExporter commented 9 years ago
I think so - I've updated to the latest and it seems to be running fine...

Petr

Original comment by klus.p...@gmail.com on 15 Apr 2013 at 6:48

GoogleCodeExporter commented 9 years ago
Great; I'm glad it's working for you.

Original comment by pmalms...@gmail.com on 28 Apr 2013 at 9:06