[Tutor] pstree cgi-script

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Wed Jun 16 18:38:30 EDT 2004


[Conrad, please keep tutor at python.org in CC.  That way, even if I'm gone
for the day, you'll still give the others there a chance to answer your
question.]



On Wed, 16 Jun 2004, Conrad Gavin wrote:

> That didnt make much difference sadly ..
>
> ###
> #!/usr/bin/python
>
> import cgitb; cgitb.enable()
>
> print "Content-type: text/plain\n\n"
> import os
> cmd = "/usr/bin/pstree"
> status = os.system(cmd)
> print status
> ###
>
> Produces the same error:
>
> [Wed Jun 16 23:17:38 2004] [error] [client 127.0.0.1] (8)Exec format
> error: exec of '/var/www/localhost/cgi-bin/pstree' failed
> [Wed Jun 16 23:17:38 2004] [error] [client 127.0.0.1] Premature end of
> script headers: pstree



That error is different from the one you were reporting earlier.
Remember, Apache originally reported:

###
[Wed Jun 16 01:18:14 2004] [error] [client 81.104.190.151] malformed
header from script. Bad header=init-+-5*[agetty]: hello.py
###



But what Apache is saying now, with,

> [Wed Jun 16 23:17:38 2004] [error] [client 127.0.0.1] (8)Exec format
> error: exec of '/var/www/localhost/cgi-bin/pstree' failed

is that it can't even execute the 'pstree' script anymore.  When we're
debugging, we have to be aware of what kind of error is being reported,
and not just that an error is occuring.


What happens if you say:

    $ /var/www/localhost/cgi-bin/pstree

from your command line?  Is the magic line:

    #!/usr/bin/python

the very first line of your script?


Good luck.




More information about the Tutor mailing list