Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #102915
| From | Peter Otten <__peter__@web.de> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: ftplib throws: IndexError: tuple index out of range |
| Date | 2016-02-14 14:40 +0100 |
| Organization | None |
| Message-ID | <mailman.107.1455457249.22075.python-list@python.org> (permalink) |
| References | <56C05CEF.5080304@rece.vub.ac.be> |
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 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.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: ftplib throws: IndexError: tuple index out of range Peter Otten <__peter__@web.de> - 2016-02-14 14:40 +0100
csiph-web