global handleText def handleText(env): data = b"" with fileLock: with open(env["fPath"],"rb") as textFile: data = textFile.read() simpleResponse( env["self"].connection,"200 OK", { "Content-Type": mimetypesText[env["fileExt"]]+ "; charset=UTF-8", "Accept-Ranges": "bytes" },data ) for t in mimetypesText: fileHandlers[t] = handleText indexFiles.append("index.html")