ftp and lowercase?

Stein Surland ssurland at online.no
Sat Jul 29 14:41:08 EDT 2000


I have made a small script using ftplib to retrieve a list from a ftp
directory. It worked OK using ftp.retrlines('LIST', lines.append).
However using it on another ftp host gives me this message:

    ftp.retrlines('ls', lines.append)
  File "/usr/lib/python1.5/ftplib.py", line 345, in retrlines
    conn = self.transfercmd(cmd)
  File "/usr/lib/python1.5/ftplib.py", line 285, in transfercmd
    return self.ntransfercmd(cmd)[0]
  File "/usr/lib/python1.5/ftplib.py", line 273, in ntransfercmd
    resp = self.sendcmd(cmd)
  File "/usr/lib/python1.5/ftplib.py", line 228, in sendcmd
    return self.getresp()
  File "/usr/lib/python1.5/ftplib.py", line 201, in getresp
    raise error_perm, resp
ftplib.error_perm: 500 'LS': command not understood. 

The host did not take the LIST command so I changed it to LS and ls. It
seems that the ftplib sends the list command in uppercase. How to change
this to lowercase? I have ftp'ed to the host and it does not recognize
LIST or LS only ls.

Stein

-- 

Stein Surland			  Trying is the first step towards failure
ssurland at online.no			- Homer Simpson
http://home.online.no/~ssurland/



More information about the Python-list mailing list