more python3
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import sys, os
|
||||
import BaseHTTPServer
|
||||
from SimpleHTTPServer import SimpleHTTPRequestHandler
|
||||
import http.server
|
||||
from http.server import SimpleHTTPRequestHandler
|
||||
|
||||
def setup_options():
|
||||
''' Create command line options '''
|
||||
@@ -25,7 +25,7 @@ def setup_options():
|
||||
def serve(options):
|
||||
""" Run the web server """
|
||||
HandlerClass = SimpleHTTPRequestHandler
|
||||
ServerClass = BaseHTTPServer.HTTPServer
|
||||
ServerClass = http.server.HTTPServer
|
||||
Protocol = "HTTP/1.0"
|
||||
|
||||
server_address = (options.address, options.port)
|
||||
@@ -36,7 +36,7 @@ def serve(options):
|
||||
httpd = ServerClass(server_address, HandlerClass)
|
||||
|
||||
sa = httpd.socket.getsockname()
|
||||
print "Serving http://"+ sa[0]+ ":"+ str(sa[1])+ "/"
|
||||
print(("Serving http://"+ sa[0]+ ":"+ str(sa[1])+ "/"))
|
||||
try:
|
||||
httpd.serve_forever()
|
||||
except KeyboardInterrupt:
|
||||
|
||||
Reference in New Issue
Block a user