Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Peter Otten <__peter__@web.de> Newsgroups: comp.lang.python Subject: Re: ftplib throws: IndexError: tuple index out of range Date: Sun, 14 Feb 2016 14:40:35 +0100 Organization: None Lines: 64 Message-ID: References: <56C05CEF.5080304@rece.vub.ac.be> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Trace: news.uni-berlin.de UQLVsp7cLeKw61n1WWEvngL3V4qBM/kglQpCkRowlJEw== 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; 'handler': 0.04; 'args.': 0.09; 'e.args[0]': 0.09; 'ftplib': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'tuple': 0.09; 'bug': 0.10; 'index': 0.13; '478': 0.16; 'eintr:': 0.16; 'frame,': 0.16; 'indexerror:': 0.16; 'innermost': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'received:t-ipconnect.de': 0.16; 'socket.py': 0.16; 'timeout,': 0.16; 'timeout.': 0.16; 'wrote:': 0.16; 'try:': 0.18; 'skip:" 30': 0.20; 'seems': 0.23; 'somewhere': 0.24; 'written': 0.24; 'header :User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'error': 0.27; 'actual': 0.28; 'looks': 0.29; 'readline': 0.29; 'raise': 0.29; 'starts': 0.29; 'program,': 0.29; 'probably': 0.31; 'skip:s 30': 0.31; 'anyone': 0.32; 'problem': 0.33; 'raised': 0.33; 'skip:/ 20': 0.33; 'file': 0.34; 'except': 0.34; 'handle': 0.34; 'remote': 0.35; 'should': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'self': 0.38; 'data': 0.39; 'to:addr:python.org': 0.40; 'still': 0.40; 'received:de': 0.40; 'some': 0.40; 'backup': 0.66; 'locals': 0.84; 'pardon': 0.84 X-Injected-Via-Gmane: http://gmane.org/ X-Gmane-NNTP-Posting-Host: p57bd970e.dip0.t-ipconnect.de User-Agent: KNode/4.13.3 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21rc2 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:102915 Antoon Pardon wrote: > I have written a small backup program, that uses ftplib to make > remote backups. However recentely the program starts to regularly > raise IndexErrors, as far as I can see the problem is in socket.py > Can anyone shed some light? > > This is the traceback: [...] > File "/usr/lib/python2.7/socket.py", line 478, in readline > if e.args[0] == EINTR: > IndexError: tuple index out of range The offending line seems to be part of try: data = self._sock.recv(self._rbufsize) except error, e: if e.args[0] == EINTR: continue raise > Locals by frame, innermost last [...] > Frame readline in /usr/lib/python2.7/socket.py at line 478 > buf = > buf_len = 0 > e = timeout() > self = > size = 8193 It looks like the actual error is socket.timeout which is probably raised from somewhere inside the stdlib without args. I think this is a bug in socket.py; the error handler should special-case with either try: ... except timeout, e: raise except error, e: ... or try: ... except error, e: if e.args and e.args[0] == EINTR: continue raise You will still have to find the cause and handle the effects of the timeout. PS: How did you produce the overview over the local variables? That looks nice.