more python3

This commit is contained in:
Ville Rantanen
2020-10-12 11:41:17 +03:00
parent 52db6b9bf4
commit dfd5111bea
3 changed files with 220 additions and 171 deletions

View File

@@ -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: