Running long script in the background
Gabriel Genellina
gagsl-py at yahoo.com.ar
Tue Feb 6 16:30:21 EST 2007
En Tue, 06 Feb 2007 16:44:52 -0300, wattersmt at gmail.com
<wattersmt at gmail.com> escribió:
> 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
If the response does not include a Content-Length header, and has a
Transfer-Encoding: chunked header, then it is sent in chunks (blocks) and
the client is able to process it piece by piece.
See the server docs on how to enable and generate a chunked response. On
Zope 2, by example, it's enough to use response.write().
> 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.
Are you sure the other process is executing? and not buffered? and you're
reading its output line by line?
--
Gabriel Genellina
More information about the Python-list
mailing list