[issue4791] retrlines('LIST') and dir hang at end of listing in ftplib (python3.0)

STINNER Victor report at bugs.python.org
Sat Jan 3 02:14:59 CET 2009


STINNER Victor <victor.stinner at haypocalc.com> added the comment:

The traceback shows that the problem is not related to the socket 
created to retrieve the content of the directory listing, but 
the "main" socket (the one used for the whole ftp session) used by 
dir() command the retrieve the command answer code:

   Traceback (most recent call last):
     ftp.dir()
      => self.retrlines(cmd, func)
      => return self.voidresp()
      => line = self.getline()
      => line = self.file.readline() (ftplib.py:184)
      ...
    socket.timeout: timed out

I don't understand why the readline() blocks. It's maybe related to 
the newline: voidresp() uses getline() which reads a line using 
self.file. The file is created by self.sock.makefile('r', 
encoding=self.encoding) and so the newline is always \n whereas ftplib 
of Python2 uses \r\n (CRLF) or \n (LF).

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4791>
_______________________________________


More information about the Python-bugs-list mailing list