cgi subprocess, cannot get output

James Stroud jstroud at ucla.edu
Tue Apr 25 23:18:27 EDT 2006


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/



More information about the Python-list mailing list