Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '(even': 0.05; 'modify': 0.07; 'report.': 0.07; 'properly.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'try:': 0.09; 'def': 0.12; 'bug': 0.12; 'email name:chris': 0.16; 'indexerror:': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'reproduce': 0.16; 'using,': 0.16; 'which,': 0.16; 'wrote:': 0.18; 'library': 0.18; 'putting': 0.22; 'header:User-Agent:1': 0.23; 'error': 0.23; 'bytes': 0.24; 'parse': 0.24; 'replace': 0.24; 'looks': 0.24; 'order.': 0.26; 'skip:_ 20': 0.27; 'header:X -Complaints-To:1': 0.27; 'raise': 0.29; 'subject:list': 0.30; 'along': 0.30; "i'm": 0.30; 'code': 0.31; 'lines': 0.31; 'usually': 0.31; 'invoke': 0.31; 'occurs': 0.31; 'anyone': 0.31; 'file': 0.32; 'run': 0.32; 'sense': 0.34; 'subject:from': 0.34; 'except': 0.35; 'something': 0.35; 'no,': 0.35; 'library.': 0.36; 'method': 0.36; 'shows': 0.36; 'responsible': 0.36; 'possible': 0.36; 'should': 0.36; 'error.': 0.37; 'question,': 0.38; 'to:addr :python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'commands': 0.60; 'skip:o 30': 0.61; 'course': 0.61; 'spawned': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Peter Otten <__peter__@web.de> Subject: Re: IndexError: pop from empty list Date: Fri, 16 May 2014 10:15:13 +0200 Organization: None References: <960b2711-6ed5-4a31-845b-7d15e39c9cf2@googlegroups.com> <5aa8abd1-05d4-4cf3-99fc-08493306b6a1@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Gmane-NNTP-Posting-Host: p57bdaf11.dip0.t-ipconnect.de User-Agent: KNode/4.11.5 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 35 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1400228133 news.xs4all.nl 2916 [2001:888:2000:d::a6]:42884 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:71649 chris@freeranger.com wrote: > No, that was pretty much what I was looking for. If anyone has an answer > to the deeper question, that would be icing on the cake. > > What is interesting is that usually the traceback shows the line of code > that I invoke which, deep inside a library I'm using, has generated an > error. In this case I don't know which of my commands has spawned the > error. > > I can experiment, I suppose, with putting a try/catch around suspected > lines of code... It looks like the xbee library is responsible for reading the right amount of bytes and then fails to parse them properly. So it is possible (even likely I think) that you have run into a bug in the library. A report to the author/maintainer should be in order. Of course it would help if you can find a way to reproduce the error. One way to do that is to modify the code def _parse_samples(self, io_bytes): try: ... # original code of the method except IndexError: # replace path with something that makes sense on your system with open("/path/to/io_bytes.data", "wb") as f: f.write(io_bytes) raise wait until the error occurs again and then send the contents of the io_bytes.data file along with your bug report.