Re: [Karrigell-main] Avoiding output buffering for pih-scripts
Brought to you by:
quentel
From: Helmut J. <jar...@sk...> - 2004-07-11 10:47:31
|
On 10 Jul, Dr. Bernd Zimmermann wrote: > Hello to all, > > I am using Karrigell with a pih-script and I am calling an external command. > > As for example in apache with modpython the output from the os.system call > seems to be send unbuffered to the browser, so that one can see what > happens. > > In my Karrigell pih-script I tried different versions, but every time > the output > from the external command is send buffered, so that one have to wait > until the > external command is finished to see the result. > > Is there a way to get the output from the external command send unbuffered > to the browser via Karrigell ? > > Below is the code: > --- schnippp --- > <% > print "<PRE>" > print > result = commands.getstatusoutput(command + ziel) > print result[1] > print > if result[0] == 0: > # TEST1 > #os.system(action + " " + option + " " + ziel) > # TEST2 > #result = commands.getoutput(action + " " + option + " " + ziel) > # TEST3 > result = os.popen(action + " " + option + " " + ziel, 'r', 0) > > for line in result: > print line > > else: > print "Check returns no result" > > print "</PRE>" > > %> > --- snippp ---- > > Is there a simple solution, or is there perhaps a deeper modification in > Karrigell needed ? > > If there are any hints, it would be great to get them. > I hope that somebody has got an Idea :-) > Since I am new to Python, here just an idea. If you are working with Linux open a pseudo terminal. See the documentation for 'pty' -- Helmut Jarausch Lehrstuhl fuer Numerische Mathematik RWTH - Aachen University D 52056 Aachen, Germany |