diff options
author | Guido van Rossum <guido@python.org> | 1995-01-12 12:42:09 +0000 |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1995-01-12 12:42:09 +0000 |
commit | 7717709f8c73b2801d263533839af47d44eb1a22 (patch) | |
tree | cac87c4ab49fa799c157e2fd7658c6fc41dc6f18 /Demo | |
parent | 985197a67558e9bdca94395084afd0774af6672e (diff) | |
download | cpython-7717709f8c73b2801d263533839af47d44eb1a22.tar.gz |
improve treatment of multi-line replies, ignore empty lines
Diffstat (limited to 'Demo')
-rwxr-xr-x | Demo/sockets/ftp.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Demo/sockets/ftp.py b/Demo/sockets/ftp.py index 1b672d3fc9..2d492398c7 100755 --- a/Demo/sockets/ftp.py +++ b/Demo/sockets/ftp.py @@ -114,7 +114,7 @@ def getreply(f): line = f.readline() if not line: break # Really an error print line, - if line[:3] == code: break + if line[:3] == code and line[3:4] != '-': break return code @@ -134,7 +134,9 @@ def getdata(r): # def getcommand(): try: - return raw_input('ftp.py> ') + while 1: + line = raw_input('ftp.py> ') + if line: return line except EOFError: return '' |