I just started learning how to use Python MapScript for MapServer so I am trying very mininal example just to see how it works. My code is:
#!/usr/bin/env python import mapscript mapfile = "/path/to/mapfile/mapfile.map" mapobject = mapscript.mapObj(mapfile) mapobject.draw()
I am writing this on Spyder 2 and I runs correctly. I then put it in /usr/lib/cgi-bin folder and try to run it on my browser with this link:
The browser throws me the following error:
Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator at webmaster@localhost to inform them of the time this error occurred, and the actions you performed just before this error. More information about this error may be available in the server error log.
And the error log only shows this:
[pid 1353] [client ::1:56156] End of script output before headers: file.py
Now how can I know what the error is? Is it right that I am putting it in /usr/lib/cgi-bin ?
EDIT: I've also set my apache2.conf file a section like this:
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory /usr/lib/cgi-bin/> Options +Indexes +ExecCGI +FollowSymLinks AddHandler cgi-script .py .cgi AllowOverride None Require all granted </Directory>