[Tutor] ftp file size puzle
Pijus Virketis
virketis@post.harvard.edu
Wed, 26 Jun 2002 20:36:36 +0300
<HTML><HEAD>
<BASEFONT FACE=3D"Arial" SIZE=3D"2" COLOR=3D"#000000">
</HEAD>
<BODY>
<div>Dear all, </div>
<div> </div>
<div>I am running into an FTP problem. Basically, I am just=
trying to work out the very basics of ftplib, and store a file=
on a server running on my own machine. Here's an example of a=
typical session, with the problem at the end.</div>
<div> </div>
<div>>>> from ftplib import FTP</div>
<div>>>> ftp =3D FTP("localhost")</div>
<div>>>> ftp.login("foo",=
"password")</div>
<div>'230 User logged in.'</div>
<div>>>> ftp.cwd("upload")</div>
<div>'250 "/upload" is current directory.'</div>
<div>>>> file =3D open("foo.pdf")</div>
<div>>>> ftp.storbinary("STOR foo.pdf", file,=
8192)</div>
<div>'226 Transfer complete. 1200 bytes in 0 sec. (0.00=
Kb/s).'</div>
<div> </div>
<div>Right, so I get an "all OK" message. Except that=
the foo.pdf file is actually 500KB big, not 1KB! This has been=
hounding me for a while now, I have tried varying the buffer=
size and the files I am sending. The file is indeed placed in=
the ftp root directory, but it is always a fraction of the size=
of the real thing: not much good at all, unfortunately. I am=
using Windows XP, Python 2.2.1 and GuildFTP as my server. But I=
am sure this has little to do with the tools, and much to do=
with some glaring error I make in my ignorance. I am pretty sure=
I have set all the permissions correctly, because I can use a=
proper FTP client with the same account to upload any file=
successfully. </div>
<div> </div>
<div>Thanks for all help, </div>
<div> </div>
<div>Pijus </div>
<div> </div>
<div>-- </div>
<div>"Anyone attempting to generate random numbers by=
deterministic means is, of course, living in a state of=
sin." -- John Von Neumann</div>
</body></html>