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


Groups > comp.lang.python > #102919 > unrolled thread

Re: ftplib throws: IndexError: tuple index out of range

Started byAntoon Pardon <antoon.pardon@rece.vub.ac.be>
First post2016-02-14 19:10 +0100
Last post2016-02-14 19:10 +0100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: ftplib throws: IndexError: tuple index out of range Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2016-02-14 19:10 +0100

#102919 — Re: ftplib throws: IndexError: tuple index out of range

FromAntoon Pardon <antoon.pardon@rece.vub.ac.be>
Date2016-02-14 19:10 +0100
SubjectRe: ftplib throws: IndexError: tuple index out of range
Message-ID<mailman.114.1455473488.22075.python-list@python.org>
Op 14-02-16 om 14:40 schreef Peter Otten:
> 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 = <cStringIO.StringO object at 0x7ff8c5d40298>
>>              buf_len = 0
>>                    e = timeout()
>>                 self = <socket._fileobject object at 0x7ff8c7b75b50>
>>                 size = 8193
> 
> It looks like the actual error is socket.timeout which is probably raised 
> from somewhere inside the stdlib without args.

I think I know what is going on. I have my own timeout mechanism at work
here, that works with signals and alarm. When the SIGALRM fires I just
raise the socket.timeout without arguments, which then causes the problem.

I defined my own timeout exception class and now raise that and the problem
disappeared. Thanks for the extra pair of eyes.

-- 
Antoon Pardon.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web