cgi subprocess, cannot get output

Jakub Piotr Nowak fname.sname.lname at gmailCUTMECUT.com
Tue Apr 25 17:16:28 EDT 2006


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



More information about the Python-list mailing list