[Python-bugs-list] [ python-Bugs-636685 ] ftplib bails out on empty responses

noreply@sourceforge.net noreply@sourceforge.net
Mon, 11 Nov 2002 09:09:26 -0800


Bugs item #636685, was opened at 2002-11-11 18:09
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=636685&group_id=5470

Category: Extension Modules
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Bastian Kleineidam (calvin)
Assigned to: Nobody/Anonymous (nobody)
Summary: ftplib bails out on empty responses

Initial Comment:
In ftplib.py, FTP.getresp(), there is:
if c in '123', and c is the first char of the reponse
line. However, if the
response is empty, then this line will throw an exception:

File "/usr/lib/python2.2/ftplib.py", line 108, in __init__
self.connect(host)
File "/usr/lib/python2.2/ftplib.py", line 133, in connect
self.welcome = self.getresp()
File "/usr/lib/python2.2/ftplib.py", line 216, in getresp
if c not in '123':
TypeError: 'in <string>' requires character as left operand
System info:
LinkChecker 1.6.6
Python 2.2.2 (#4, Oct 15 2002, 04:21:28)
[GCC 2.95.4 20011002 (Debian prerelease)] on linux2 

I suggest you test if c is a character before calling
the if-clause.

Cheers, Bastian

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=636685&group_id=5470