A newbie question on ftplib.
Fredrik Lundh
fredrik at pythonware.com
Thu Mar 29 06:21:01 EST 2001
Srihari Vijayaraghavan wrote:
> When I execute the following statement under Linux it uploads the binary
> file properly, but under Windows NT it creates only 512 bytes file at the
> ftp server.
>
> ftp.storbinary('STOR ' + xyz, open(xyz), 1024)
>
> I tried various values (1, 128, 256, 515) for the "number of blocks"
> parameter.
did you try reading from the file?
to make sure you get all data from a binary file, you
need to open it in binary mode. try this:
ftp.storbinary('STOR ' + xyz, open(xyz, 'rb'), 1024)
see the "builtin functions" section in the library reference for
more info on open.
Cheers /F
More information about the Python-list
mailing list