Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #71649

Re: IndexError: pop from empty list

From Peter Otten <__peter__@web.de>
Subject Re: IndexError: pop from empty list
Date 2014-05-16 10:15 +0200
Organization None
References <960b2711-6ed5-4a31-845b-7d15e39c9cf2@googlegroups.com> <mailman.10056.1400215690.18130.python-list@python.org> <5aa8abd1-05d4-4cf3-99fc-08493306b6a1@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.10062.1400228133.18130.python-list@python.org> (permalink)

Show all headers | View raw


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.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

IndexError: pop from empty list chris@freeranger.com - 2014-05-15 21:36 -0700
  Re: IndexError: pop from empty list Gary Herron <gary.herron@islandtraining.com> - 2014-05-15 21:48 -0700
    Re: IndexError: pop from empty list chris@freeranger.com - 2014-05-15 22:08 -0700
      Re: IndexError: pop from empty list Peter Otten <__peter__@web.de> - 2014-05-16 10:15 +0200
  Re: IndexError: pop from empty list Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-05-16 06:41 +0000

csiph-web