Python CGI returning an http status code, such as 403?
print 'Status: 403 Forbidden'print
Works for me. You do need the second print though, as you need a double-newline to end the HTTP response headers. Otherwise your web server may complain you aren't sending it a complete set of headers.
sys.stdout('Status: 403 Forbidden\r\n\r\n')
may be technically more correct, according to RFC (assuming that your CGI script isn't running in text mode on Windows). However both line endings seem to work everywhere.