move log assignment and friends to be in-scope

This commit is contained in:
randomuser 2021-07-20 02:59:59 -05:00
parent b3a665448a
commit d35296ef16
1 changed files with 4 additions and 4 deletions

View File

@ -3,10 +3,6 @@ import subprocess
import os
import time
host = "localhost"
port = 77
log = Logger()
class GopherError(BaseException): pass
class RequestError(GopherError): pass
@ -187,6 +183,10 @@ class GopherHandler(socketserver.BaseRequestHandler, GopherServerLogic):
log.log("serving {}".format(file[0]))
self.serveFile(file[0], parsed[1], file[1])
log = Logger()
host = "localhost"
port = 77
if __name__ == "__main__":
with socketserver.TCPServer((host, port), GopherHandler) as server:
server.serve_forever()