Python CGI Error 500: Premature end of script headers -
i have complex python script im trying run imports other self-written modules , things sqlite. when go run script, 500: internal server error , log says: premature end of script headers.
i know means don't have header correctly placed/typed believe do.
#!/usr/bin/env python import cgi import cgitb; cgitb.enable(logdir=..., format="text") print "content-type: text/html" print looks right, right?
i continue script , print results @ end. other modules don't have header or hashbang, think that's fine.
what problem be?
i had same problem. solved it:
#!/usr/bin/env python # -*- coding: utf-8 -*- . . . print "content-type: text/plain;charset=utf-8" print
Comments
Post a Comment