socket: Did I find a bug?

dieter dieter at handshake.de
Fri Mar 9 01:45:54 EST 2018


Antoon Pardon <antoon.pardon at vub.be> writes:
> This is on a debian 9 box python 2.7.13
>
> My interpretation is that a timeout exception is thrown and that the
> args attribute of such an exception is an empty tuple which then causes
> an IndexError in line 482 of module /usr/lib/python2.7/socket.py. Does
> that soundplausible?

Yes -- however, usually the "args" tuple of an exception is not empty.

I am using the FTP class in Python 2.7 myself and I am quite
(though not completely) sure that I already have had timeouts in
my FTP interaction -- without seeing your problem.

Nevertheless, you might see a bug: there are two kinds of timeouts:
connection and read timeout. You are facing a read timeout (if
you see a timeout at all); while I likely saw connection timeouts.
However, the resulting timeout exception should in both cases
be identical with respect to the "args" tuple.

> Here is the traceback:
>
> Traceback (most recent call last):
> ...
>   File "/usr/local/lib/python-apps/rmtdump/ftputil.py", line 211, in open
>     return ftpfile(ftp, fn, mode, True)
>   File "/usr/local/lib/python-apps/rmtdump/ftputil.py", line 70, in __init__
>     self.cnct =  self.ftp.transfercmd("%s %s" % (cmd, rfn))
>   File "/usr/lib/python2.7/ftplib.py", line 376, in transfercmd
>     return self.ntransfercmd(cmd, rest)[0]
>   File "/usr/lib/python2.7/ftplib.py", line 710, in ntransfercmd
>     conn, size = FTP.ntransfercmd(self, cmd, rest)
>   File "/usr/lib/python2.7/ftplib.py", line 339, in ntransfercmd
>     resp = self.sendcmd(cmd)
>   File "/usr/lib/python2.7/ftplib.py", line 249, in sendcmd
>     return self.getresp()
>   File "/usr/lib/python2.7/ftplib.py", line 215, in getresp
>     resp = self.getmultiline()
>   File "/usr/lib/python2.7/ftplib.py", line 201, in getmultiline
>     line = self.getline()
>   File "/usr/lib/python2.7/ftplib.py", line 186, in getline
>     line = self.file.readline(self.maxline + 1)
>   File "/usr/lib/python2.7/socket.py", line 482, in readline
>     if e.args[0] == EINTR:
> IndexError: tuple index out of range




More information about the Python-list mailing list