Coding problems with ftplib and uploading a file

pem at my-deja.com pem at my-deja.com
Fri Feb 18 14:58:27 EST 2000


Greetings,

I am new to python and have my first program near completion, however
the last step has caused me great troubles.  What I need to do is
upload a file to a server via ftp.  Very simple.  My code looks like
this:

     ftp = FTP('servername')
     ftp.login('uname', 'passwd')
     ftp.sendcmd('cdup')
     ftp.sendcmd('cdup')
     ftp.cwd('/web')
     fini = open('/myfile.html').readlines()
     ftp.storlines('STOR ' fini)
     ftp.quit()

All of the commands work just fine except for the storlines command.  I
have read all of the documentation available to me at work (Programming
in Python and Learning Python, and web docs on ftplib) but none are
clear about the syntax of the storlines command.  In addition, I read
the ftplib.py as well as the rfc 959 on FTP and I guess I am just not
getting it.  Any help would be greatly appreciated.

BTW, Python is a wonderful programming language.  I don't think I will
ever go back to Perl.


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list