cgi subprocess, cannot get output
Hello, In the following cgi program, I cannot get subprocess output. I print the header, flush stdout to prepare it to new content, but variable 'o' is always empty. Could somebody help me with that? def main(): print "Content-type: text/html\n\n" sys.stdout.flush() if form.has_key('sentence'): input = form['sentence'].value o = Popen(['./tinki', input], stdout=PIPE).communicate()[0] result = cgi.escape(o) results['xmlfile'] = result results['sentence'] = input content['output'] = (output % results) print template % content Best regards, -- Jakub P. Nowak -- http://mail.python.org/mailman/listinfo/python-list
Re: cgi subprocess, cannot get output
Jakub Piotr Nowak wrote: > Hello, > > In the following cgi program, I cannot get subprocess output. > I print the header, flush stdout to prepare it to new content, > but variable 'o' is always empty. > > Could somebody help me with that? > > def main(): > print "Content-type: text/html\n\n" > sys.stdout.flush() > > if form.has_key('sentence'): > input = form['sentence'].value > > o = Popen(['./tinki', input], stdout=PIPE).communicate()[0] > result = cgi.escape(o) > > results['xmlfile'] = result > results['sentence'] = input > > content['output'] = (output % results) > print template % content > > > Best regards, What kind of script is tinki? I had a bitch of a problem like this with perl and ended up just writing to a file. No idea why I couldn't get the stdout. James -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: cgi subprocess, cannot get output
Dnia 26.04.2006 James Stroud <[EMAIL PROTECTED]> napisa³/a: } Jakub Piotr Nowak wrote: }> Hello, }> }> In the following cgi program, I cannot get subprocess output. }> I print the header, flush stdout to prepare it to new content, }> but variable 'o' is always empty. }> }> Could somebody help me with that? }> }> [...mniam...] }> }> Best regards, } } What kind of script is tinki? I had a bitch of a problem like this with } perl and ended up just writing to a file. No idea why I couldn't get the } stdout. Tinki is a natural language parser. It takes a sentence as a command line argument and prints xml file to stdout. Thanks for the hint, I will try... Best regards, -- Jakub P. Nowak -- http://mail.python.org/mailman/listinfo/python-list