当我试图从浏览器中触发CGI中的Python脚本时,我得到了这个错误;
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我没有以根用户身份运行主进程($ python-32 main.py)。
This topic似乎不适合我。
使脚本成为可执行文件也不起作用($ chmod +x index.py、-rwxr-xr-x)。
发布于 2013-04-20 21:08:55
终于让它起作用了。这是基本的脚本;
index.py
#!/usr/bin/env python
import cgi
print 'Content-Type: text/html\n\n'
print ''
print 'test'需求
文件必须是可执行文件;$ chmod +x index.py
#!/usr/bin/env python
希望它能在未来帮助到某个人。
https://stackoverflow.com/questions/16120621
复制相似问题