ftplib - uploading files using transfercmd?

Kevin Ollivier kevino at tulane.edu
Fri Mar 19 13:26:05 EST 2004


On 19 Mar 2004 06:24:13 -0800, stewart at midwinter.ca (Stewart
Midwinter) wrote:

>Kevin Ollivier <kevino at tulane.edu> wrote in message news:<ti7l50tfm3k5dmu11q9sfui1q8e85mav1h at 4ax.com>...
>> The first file uploads just fine, but on the second file I'm
>> consistently seeing a weird problem where the response to the PORT
>> command (sent by self.makeport()) comes *after* the STOR command is
>> sent. 
>
>Kevin, when you make a socket connection to the server, are you used
>blocking or non-blocking?   A blocking connection won't proceed until
>it gets a response, while the non-blocking will - and perhaps your
>problem lies there.  your 2nd command gets a response before the first
>one comes back.

I am using whatever method ftplib uses by default, in other words, I
do not explicitly set the socket as blocking or non-blocking. 

After reading your reply (and the other I received), I tried
explicitly calling setblocking(1) on both the FTP socket (ftp.sock)
and the socket that is returned when I call transfercmd. However, the
PORT call's response still comes after the STOR command. (As far as I
could tell, setting blocking mode seemed to do nothing.)

>Does indeed your problem only happen at the beginning, or can it
>happen anywhere in your list of files?

It does always happen at the beginning, even when uploading to
different servers. But since I cannot get it to upload more than the
first file, I do not know if it would happen at other points in the
upload. 

Thanks for your help!

Kevin



More information about the Python-list mailing list