服务器遇到内部错误,无法完成您的请求

时间:2015-05-15 04:40:09

标签: python html

我是蟒蛇的新手。我正在尝试使用一个简单的python脚本和HTML,如下面的代码所示:

html code- ex1.html

<!doctype html>  
<html>  
<head>  
<title>demo web file python3.2</title>  
</head>  
<body>  
<form name="pyform" method="POST" action="/cgi-bin/form.py">  
  <input type="text" name="fname" />  
  <input type="submit" name="submit" value="Submit" />  
</form>  
</body>  
</html>  

Python script-form.py

#!"C:\python34\python.exe"
print("Content-Type: text/html")      
print()                               

import cgi,cgitb  
cgitb.enable() #for debugging  
form = cgi.FieldStorage()  
name = form.getvalue('fname')  
print("Name of the user is:",name) 

并在本地主机中执行 http://localhost/cgi-bin/ex1.html

给出错误

  

服务器错误!

     

服务器遇到内部错误但无法完成   你的申请。服务器过载或出现错误   一个CGI脚本。

     

如果您认为这是服务器错误,请与网站管理员联系。

     

错误500

     

localhost Apache / 2.4.2(Win32)OpenSSL / 1.0.1c PHP / 5.4.4

0 个答案:

没有答案
相关问题