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

Christopher Mahan report at bugs.python.org
Fri Jan 2 07:50:18 CET 2009


Christopher Mahan <chris.mahan at gmail.com> added the comment:

I added the following two lines and I was able to run the code.


Before: 
            line = fp.readline()
            if self.debugging > 2: print('*retr*', repr(line))
            if not line:
                break
            if line[-2:] == CRLF:
                line = line[:-2]
            elif line[-1:] == '\n':
                line = line[:-1]
            callback(line)

After: 
            line = fp.readline()
            if self.debugging > 2: print('*retr*', repr(line))
            if not line:
                break
            if line == '':
                break
            if line[-2:] == CRLF:
                line = line[:-2]
            elif line[-1:] == '\n':
                line = line[:-1]
            callback(line)

As a patch:

426,427d425
<             if line == '':
<                 break

What else do I need to do?

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


More information about the Python-bugs-list mailing list