help please- ftplib

Fredrik Lundh fredrik at pythonware.com
Sun May 16 09:54:16 EDT 1999


<gony at my-dejanews.com> wrote:
> oky doky, form my last post i have progressed
> 
> I can now retrieve files from the server using "retrbinary"
> 
> now i'm trying to send files to the server from my machine heress the
> code i'm using and the error i get:
> 
> >>> from ftplib import FTP
> >>> ftp = FTP('s3.virtualave.net','gony','********')
> >>> ftp.storbinary('STOR test.txt', open('test.txt', 'r').read)
> Traceback (innermost last):
>   File "<pyshell#2>", line 1, in ?
>     ftp.storbinary('STOR test.txt', open('test.txt', 'r').read)
> TypeError: not enough arguments; expected 4, got 3

use:

    file = "test.txt"
    ftp.storbinary("STOR " + file, open(file, "rb"), 1024)

or to upload a text file,

    ftp.storlines("STOR " + file, open(file))

</F>





More information about the Python-list mailing list