39 lines
1.0 KiB
Plaintext
39 lines
1.0 KiB
Plaintext
From: fredrik at pythonware.com (Fredrik Lundh)
|
|
Date: Sun, 16 May 1999 13:54:16 GMT
|
|
Subject: help please- ftplib
|
|
References: <7hmdlc$kk1$1@nnrp1.deja.com>
|
|
Message-ID: <004a01be9fa3$976c5ee0$f29b12c2@pythonware.com>
|
|
X-UID: 1830
|
|
|
|
<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>
|
|
|
|
|
|
|
|
|
|
|