I am new to Python and am trying to run a very simple Python script on a web page, using the tutorial on web.py. When I installed web.py through the terminal it said it installed successfully, but when I try to run hello.py I get the following error messages (screenshot and text below), and nothing opens on my localhost. error message
----------------------
CODE FROM WEB.PY
----------------------
import web
urls = (
'/', 'hello')
app = web.application(urls, globals())
class hello:
def GET(self):
return 'Hello, web!'
if __name__ == "__main__":
app.run()
ERROR MESSAGE
The above is a description of an error in a Python program, formatted for a Web browser because the 'cgitb' module was enabled. In case you are not reading this in a Web browser, here is the original traceback:
Traceback (most recent call last): File "hello.py", line 1, in <module> import web File "/Users/swanstro/Desktop/web/init.py", line 14, in <module> import utils, db, net, wsgi, http, webapi, httpserver, debugerror File "/Users/swanstro/Desktop/web/wsgi.py", line 8, in <module> import http File "/Users/swanstro/Desktop/web/http.py", line 16, in <module> import net, utils, webapi as web File "/Users/swanstro/Desktop/web/webapi.py", line 31, in <module> import sys, cgi, Cookie, pprint, urlparse, urllib File "/Users/swanstro/Desktop/cgi.py", line 22, in <module> form = cgi.FieldStorage() AttributeError: 'module' object has no attribute 'FieldStorage'
Any help would be welcome. Thanks.