Dennis Lee Bieber
3/9/2010 6:52:00 AM
On Mon, 08 Mar 2010 15:30:39 -0500, monkeys paw <monkey@joemoney.net>
declaimed the following in gmane.comp.python.general:
> ftp.storlines('STOR', 'sf.xml') # Is this incorrect, it throws error>
Error 1: You didn't supply the destination file name on the STOR
command
Error 2: You didn't supply an open file object from which to retrieve
the lines to be transferred
myfile = open(local_file_name, "rt")
ftp.storlines("STOR sf.xml", myfile)
myfile.close()
All of which you could have found by reading the standard library
documentation supplied with Python.
>From the help system:
-=-=-=-=-=-=-
storbinary( command, file[, blocksize])
Store a file in binary transfer mode. command should be an appropriate
"STOR" command: "STOR filename". file is an open file object which is
read until EOF using its read() method in blocks of size blocksize to
provide the data to be stored. The blocksize argument defaults to 8192.
Changed in version 2.1: default for blocksize added.
storlines( command, file)
Store a file in ASCII transfer mode. command should be an appropriate
"STOR" command (see storbinary()). Lines are read until EOF from the
open file object file using its readline() method to provide the data to
be stored.
-=-=-=-=-=-=-
--
Wulfraed Dennis Lee Bieber KD6MOG
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/