Tags
A Simple python script that acts as a web server, and handles requests
import SimpleHTTPServer import SocketServer PORT = 8000 class SimpleServer(): #Simple Http server python usage def start(self): Handler = SimpleHTTPServer.SimpleHTTPRequestHandler httpd = SocketServer.TCPServer(("", PORT), Handler) print "serving at port", PORT httpd.serve_forever() if __name__ == "__main__": SimpleServer.start()
There is a error in line number 16.
“TypeError: unbound method start() must be called with SimpleServer instance as first argument (got nothing instead)”
I changed it with “SimpleServer().start()”
And now it works just fine.
I am using python 2.6.
May be your code is working fine for some other version of Python…?