uploading a binary file with ftplib

thehaas at my-deja.com thehaas at my-deja.com
Mon Mar 6 23:20:21 EST 2000


I've submitted this to python.faqts.com, but no one has answered.  So
I'm asking it here. . .

I'm trying to upload a binary file to a site using ftplib.  I can log in
successfully and do "cd dir_name", but cannot figure out how to upload
the file.  The standard Python module documentation seems a bit cryptic
to me in this case (though it is usually quite good).  This is the
command I have used:

ftp.storbinary('stor ravine.pyc',open('ravine.pyc','r').read(),2)

And this is my result:

Traceback (innermost last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python1.5/ftplib.py", line 366, in storbinary
    buf = fp.read(blocksize)
AttributeError: 'string' object has no attribute 'read'

Anyone have any insight?

Thanks a lot,

- mikeh


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



More information about the Python-list mailing list