ftpilb.FTP.stor...() freeze mystery

Anthra Norell anthra.norell at bluewin.ch
Wed Oct 28 12:05:22 CET 2009

Gabriel Genellina wrote:
> En Tue, 27 Oct 2009 07:53:36 -0300, Anthra Norell
> <anthra.norell at bluewin.ch> escribió:
>>   I am trying to upload a bunch of web pages to a hosting service. I 
>> have a connected ftplib.FTP object and can upload files manually from 
>> an IDLE command line using the methods storlines () for html files 
>> and storbinary () for the pictures. So far no problem. In order to 
>> upload the whole set of files I wrote a loop that iterates through 
>> the file names and calls either of the stor... () methods as 
>> appropriate. The loop successfully uploads eight of some twenty files 
>> and then freezes. Ctrl-C doesn't unlock the freeze. I have to kill 
>> the IDLE window which raises a confirmation request "are you sure? 
>> The program is still running." Having no alternative I am sure. I 
>> open a new IDLE window and start over. Every retry fails the exact 
>> same way.
>   From the description alone I can't infer any problem. Certainly 
> uploading
> files with ftplib worked fine last time I tried. Try to remove all
> unnecesary lines from your script, making it as small as possible but
> still showing your problem, and post it here.
   Thank you for your suggestion. In the meantime I uploaded my entire 
webseite hacker style, listing the server directories after each 
freeze-restart and shortening the list of files to transfer by the ones 
that passed before the last freeze. The exercise revealed that the 
freezes are less predictable than it seemed in the beginning. On one 
occasion it occurred after the transfer of a single file from the IDLE 
command line (my_ftp_object.storlines ("STOR file_name", f). The file 
did upload. So the freezes seem to occur after a successful transfer. 
The command-line freeze is evidence of an ftp protocol implementation or 
timing problem between the ftplib module and the hosting server. My code 
that passes files to the FTP object for transmission one by one is off 
the hook, so I won't bother you with it. Of course, I am in contact with 
the hosting service, but expect them not to assume the burden of proof. 
If you (or someone else) would suggest a means to visualize the 
transfer, dumping a stack or writing a log or something of that sort, I 
think I'd be on the right track.


More information about the Python-list mailing list