Apache & Python 500 Error

Jeremy Bowers jerf at jerf.org
Thu Feb 3 14:20:26 EST 2005


On Thu, 03 Feb 2005 13:55:13 +0100, Christian wrote:
>     from mod_python import apache
>     ^
> SyntaxError: invalid syntax
> 
> ----
> My test script:
> #!/usr/bin/python
> 
> print 'Content-Type: text/plain\r'
> print '\r'
> import os
> print os.getcwd()

For the quote of the error message, I've taken the liberty of stripping
off the apache-added stuff off the front so you can read it better.

You should now be able to easily see that the error message and your shown
program don't mesh. That error appears to be from an earlier run.

Even so, I can tell you one thing: The error resulted from indenting your
"from mod_python import apache" call that you no longer have. Python uses
whitespace for structure, and just as you must indent the body of loops,
you must *not* extraneously indent other things (line continuations
don't count).

You'll need to post the correct error message after configuring Apache for
CGI as Peter showed, unless of course you figure out the problem.



More information about the Python-list mailing list