From: Anthra Norell on
Hi,
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.
My upload method with the loop has a preview mode. It goes through
all the motions including opening and closing my source files but skips
the stor... () methods and in addition displays all commands. The
preview mode completes the iteration sequence and shows nothing unexpected.
What could be the problem? I am totally
fazed and will be most grateful for expert suggestions.

Frederic

From: Gabriel Genellina on
En Tue, 27 Oct 2009 07:53:36 -0300, Anthra Norell
<anthra.norell(a)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.

--
Gabriel Genellina

From: Gabriel Genellina on
En Tue, 27 Oct 2009 07:53:36 -0300, Anthra Norell
<anthra.norell(a)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.

--
Gabriel Genellina

From: Anthra Norell on
Gabriel Genellina wrote:
> En Tue, 27 Oct 2009 07:53:36 -0300, Anthra Norell
> <anthra.norell(a)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.
>
Gabriel,
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.

Frederic



From: Gabriel Genellina on
En Wed, 28 Oct 2009 08:05:22 -0300, Anthra Norell
<anthra.norell(a)bluewin.ch> escribi�:
> Gabriel Genellina wrote:
>> En Tue, 27 Oct 2009 07:53:36 -0300, Anthra Norell
>> <anthra.norell(a)bluewin.ch> escribi�:
>>
>>> I am trying to upload a bunch of web pages to a hosting service.[...]
>>> 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

> 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.

In this thread from last month, Sean DiZazzo shows how to add a timeout
parameter to storbinary:
http://comments.gmane.org/gmane.comp.python.general/639258
Do the same with storlines and see whether it helps.

--
Gabriel Genellina