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


Groups > comp.lang.python > #71638

Re: IndexError: pop from empty list

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <gary.herron@islandtraining.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.015
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'pop': 0.05; 'list?': 0.07; 'received:67.192': 0.09; 'received:67.192.241': 0.09; 'received:dfw.emailsrvr.com': 0.09; 'thread': 0.14; '*why*': 0.16; 'email name:chris': 0.16; 'indexerror:': 0.16; 'lambda': 0.16; 'exception': 0.16; 'wrote:': 0.18; 'input': 0.22; 'header:User- Agent:1': 0.23; 'error': 0.23; 'received:emailsrvr.com': 0.24; 'received:(smtp server)': 0.26; 'skip:" 30': 0.26; 'asking': 0.27; 'header:In-Reply-To:1': 0.27; 'subject:list': 0.30; 'skip:( 20': 0.30; 'gary': 0.31; 'file': 0.32; 'run': 0.32; 'running': 0.33; '(most': 0.33; 'skip:_ 10': 0.34; 'subject:from': 0.34; 'skip:s 30': 0.35; 'something': 0.35; 'but': 0.35; 'really': 0.36; 'collecting': 0.36; 'skip:" 50': 0.36; 'thanks': 0.36; 'error.': 0.37; 'list': 0.37; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'recent': 0.39; 'to:addr:python.org': 0.39; 'skip:x 10': 0.40; 'days': 0.60; 'series': 0.66; 'serial': 0.72; '95,': 0.84; 'info)': 0.84; 'self.run()': 0.84
X-Virus-Scanned OK
Date Thu, 15 May 2014 21:48:00 -0700
From Gary Herron <gary.herron@islandtraining.com>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0
MIME-Version 1.0
To python-list@python.org
Subject Re: IndexError: pop from empty list
References <960b2711-6ed5-4a31-845b-7d15e39c9cf2@googlegroups.com>
In-Reply-To <960b2711-6ed5-4a31-845b-7d15e39c9cf2@googlegroups.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.10056.1400215690.18130.python-list@python.org> (permalink)
Lines 36
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1400215690 news.xs4all.nl 2920 [2001:888:2000:d::a6]:59263
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:71638

Show key headers only | View raw


On 05/15/2014 09:36 PM, chris@freeranger.com wrote:
> Any ideas about what this might mean?
>
> Running Debian Wheezy on a RaspBerry Pi and collecting data on a dispatch thread that is reading input on the serial port (connected to xbee series 1).
>
> It happens every few days but it really chokes the program.
>
> Thanks for any tips,
> ChrisJ
>
>
>
>
> Exception in thread Thread-2:
> Traceback (most recent call last):
>    File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
>      self.run()
>    File "/usr/local/lib/python2.7/dist-packages/xbee/base.py", line 95, in run
>      self._callback(self.wait_read_frame())
>    File "/usr/local/lib/python2.7/dist-packages/xbee/base.py", line 400, in wait_read_frame
>      return self._split_response(frame.data)
>    File "/usr/local/lib/python2.7/dist-packages/xbee/base.py", line 288, in _split_response
>      info[parse_rule[0]] = parse_rule[1](self, info)
>    File "/usr/local/lib/python2.7/dist-packages/xbee/ieee.py", line 117, in <lambda>
>      lambda xbee,original: xbee._parse_samples(original['samples'])
>    File "/usr/local/lib/python2.7/dist-packages/xbee/base.py", line 357, in _parse_samples
>      digital_data_set = (sample_bytes.pop(0) << 8 | sample_bytes.pop(0))
> IndexError: pop from empty list

The error means that sample_bytes is an empty list so calling pop is an 
error.

Or were you asking something deeper, like *why*  sample_bytes is an 
empty list?

Gary Herron

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