简体   繁体   中英

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

500 Server Error

A misconfiguration on the server caused a hiccup. 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]

hello.py content is:

#!/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. If it is 3.3 then the print statements should be changed to print() with the brackets.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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