简体   繁体   English

Python 500服务器错误

[英]500 Server Error in Python

I try to write a simple Python script but it gave me this error when testing it in the browser 我尝试编写一个简单的Python脚本,但在浏览器中对其进行测试时却出现了此错误

500 Server Error 500服务器错误

A misconfiguration on the server caused a hiccup. 服务器上的配置错误导致了打ic。 Check the server logs, fix the problem, then try again. 检查服务器日志,解决问题,然后重试。

URL: http://example.com/cgi-bin/hello.py Not executable: [/home1/example/public_html/cgi-bin/hello.py] 网址: http : //example.com/cgi-bin/hello.py无法执行:[/home1/example/public_html/cgi-bin/hello.py]

hello.py content is: hello.py的内容是:

#!/usr/bin/python
# -*- coding: UTF-8 -*-

# enable debugging
import cgitb
cgitb.enable()

print "Content-Type: text/plain;charset=utf-8"
print

print "Hello World!"

I'm on shared hosting, according to my web hosting provider the error is in my code. 我在共享主机上,根据我的网络托管提供商的说法,错误出在我的代码中。 Please help me to make this little thing work. 请帮助我使这件事变得有效。 Thanks in advanced! 提前致谢!

It looks like a permissions problem. 看来是权限问题。 The only other suggestion I have is to check what version of Python is installed on the server. 我唯一的其他建议是检查服务器上安装了哪个版本的Python。 If it is 3.3 then the print statements should be changed to print() with the brackets. 如果为3.3,则应将带有括号的print语句更改为print()。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM