Running long script in the background

wattersmt at gmail.com wattersmt at gmail.com
Tue Feb 6 14:44:52 EST 2007


On Feb 6, 2:02 pm, Dennis Lee Bieber <wlfr... at ix.netcom.com> wrote:
> On 6 Feb 2007 07:37:33 -0800, "watter... at gmail.com"
> <watter... at gmail.com> declaimed the following in comp.lang.python:
>
>
>
> > Everything works fine until I call the popen function, then it
> > freezes.  What I want is to print the output in real time, just like
> > it does when I run it from a shell.
>
>         And you want /this/ in a web page?
>
>         I don't think HTTP is designed for that... As I understand it, it
> expects to get a complete page back and then the transaction is complete
> and forgotten (except for the presence of session cookies). To report
> dynamically on a web page tends to either be something like a
> timed-redirect (reload) of the same URL with the cookie, and that is a
> completely separate transaction starting a new CGI (or equivalent)
> process. AJAX techniques may clean up some of this -- by not really
> reloading the whole page, instead updating the DOM based upon data
> transferred.


Web pages can show output as it's sent.  For testing I created a
script on the server that untars a 600 meg volume, I can see each file
name show up in my browser instantly, just like it should.  The other
script I'm trying to run won't show anything until the entire process
is complete and it's just a bunch of echo statements in a for loop,
I'm not sure why they behave differently.






More information about the Python-list mailing list