[NEWBIE] ftplib error?

Stefan Schwarzer s.schwarzer at ndh.net
Wed Jan 16 15:47:42 EST 2002

Hello Bruce

I can't really help on your original question but have some other

Bruce Dykes wrote:
> import ftplib
> hostname = ftplib.FTP("")

I agree with the others that the failure may be due a wrong port.

> hostname.login("joeuser","mydogsname")
> hostname.cwd("$SYSTEM.DATA")    #  see below

Is the directory literally $SYSTEM.DATA or is SYSTEM some environment
variable? AFAIK, ftplib doesn't support "interpolating" of environment

> hostname_numbers = hostname.retrlines("GET ALARMDATA")

I think, it should be RETR instead of GET? Then, retrlines is not so
similar to file.readlines. :-) From help(ftplib.FTP.retrlines):

Help on method retrlines in module ftplib:

retrlines(self, cmd, callback=None) unbound ftplib.FTP method
    Retrieve data in line mode.
    The argument is a RETR or LIST command.
    The callback function (2nd argument) is called for each line,
    with trailing CRLF stripped.  This creates a new port for you.
    print_line() is the default callback.


More information about the Python-list mailing list