469,929 Members | 1,797 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,929 developers. It's quick & easy.

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
Apr 25 '06 #1
2 3484
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/
Apr 26 '06 #2
Dnia 26.04.2006 James Stroud <js*****@ucla.edu> 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
Apr 27 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Qiangning Hong | last post: by
5 posts views Thread by Grant Edwards | last post: by
12 posts views Thread by Eric_Dexter | last post: by
9 posts views Thread by Phoe6 | last post: by
12 posts views Thread by bhunter | last post: by
7 posts views Thread by skunkwerk | last post: by
5 posts views Thread by thedsadude | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.