newbie needs a little help... trying to write an ftp script.

Diez B. Roggisch deets_noospaam at web.de
Mon Jul 28 14:58:10 EDT 2003


> import ftplib
> 
> ftp = ftplib.FTP('172.30.30.30')  # This is wrong,  somehow...?
> ftp.login(user,pass)
> ftp.retrlines('LIST')  # I believe it might need to be
> ftp.retrlines('ls -al')
> ftp.sendcmd('prompt')
> ftp.cwd('folder')
> ftp.retrbinary(retr *tgz)
> ftp.quit()

Your example worked fine with me for "ftp.suse.com" - at least the first 3
lines. It didn't understand ls -al and prompt, and a folder "folder" didn't
exist of course.

The ftp.retrbinary(retr *tgz) is also flawed - what is retr, a variable? I
think you need to look up that command again. And *tgz can't be right, too.
You most probably want "*tgz" there (a string literal)

ftp.quit() works.

Diez





More information about the Python-list mailing list