Access to Python CGIHTTPServer denied on OS X

I get this error when trying to run a Python script inside a CGI from a browser;

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/CGIHTTPServer.py", line 251, in run_cgi
    os.execve(scriptfile, args, env)
OSError: [Errno 13] Permission denied
1.0.0.127.in-addr.arpa - - [20/Apr/2013 14:51:16] CGI script exit status 0x7f00

I do not start the main process as root ( $ python-32 main.py).

This section does not seem to work for me.

Executing the script executable also did not help ( $ chmod +x index.py, -rwxr-xr-x).

+5
source share
1 answer

Finally he earned. This is a basic script;

index.py

#!/usr/bin/env python
import cgi
print 'Content-Type: text/html\n\n'
print ''
print 'test'

Requirements

  • The file must be executable; $ chmod +x index.py
  • The file must have #!/usr/bin/env python

Hope this can help someone in the future.

+9
source

All Articles