[Tutor] pstree cgi-script

Chad Crabtree flaxeater at yahoo.com
Tue Jun 15 23:20:29 EDT 2004

--- Conrad Gavin <gubbs at fudo.org> wrote:
> Hi there. 
> I'm trying to write a simple little cgi-script that executes pstree
> and
> echos/prints the output to the webpage ..
> Clearly I am doing it wrong, as it will not work. 
> Here's my code:
> #!/usr/bin/python
> import os
> cmd = "pstree"
> status = os.system(cmd)
> print "Status:", status
Ok this is an easy one.  I also had this problem at first with cgi. 
you need to put 
print "text/plain/n/n"
in this case at the begining of the script this tells apache to tell
the browser whats going on.  Otherwise apache croaks.  If you
outputing html then type
print "text/html/n/n"

The two caraiage returns are important.  There you go good luck

Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.

More information about the Tutor mailing list