"TypeError: 'tuple' object is not callable"
"TypeError: 'tuple' object is not callable"
所以我正在尝试制作一个 Growtopia 服务器模拟器,但实际上我遇到了这个令人困惑的错误。我找不到任何关于...
这是我的代码
import cgi #not used yet
import http.server
import logging #not used yet
import socketserver
class ServerHandler(http.server.BaseHTTPRequestHandler):
def do_POST(self):
self.send_response(200)
self.end_headers()
self.wfile.write("server|127.0.0.1\nport|17091\ntype|1\n#maint|Mainetrance message (Not used for now) -- Growtopia Noobs\n\nbeta_server|127.0.0.1\nbeta_port|17091\n\nbeta_type|1\nmeta|localhost\nRTENDMARKERBS1001")
def do_GET(self):
self.send_response(200)
self.end_headers()
self.wfile.write("server|127.0.0.1\nport|17091\ntype|1\n#maint|Mainetrance message (Not used for now) -- Growtopia Noobs\n\nbeta_server|127.0.0.1\nbeta_port|17091\n\nbeta_type|1\nmeta|localhost\nRTENDMARKERBS1001")
def log_message(self, format, *args):
return
PORT = 80
HOST = ""
Handler = http.server.SimpleHTTPRequestHandler,ServerHandler
OUT_HOST = HOST
httpd = socketserver.TCPServer((HOST, PORT), Handler)
print("Server Port : ", PORT)
if OUT_HOST == "" or " " or "\n":
print("Server Hostname : ", "localhost")
else:
print("Server Hostname : ", HOST)
httpd.serve_forever()
我通过将 Handler = http.server.SimpleHTTPRequestHandler
添加到 ServerHandler Class 中解决了这个问题。
所以我正在尝试制作一个 Growtopia 服务器模拟器,但实际上我遇到了这个令人困惑的错误。我找不到任何关于...
这是我的代码
import cgi #not used yet
import http.server
import logging #not used yet
import socketserver
class ServerHandler(http.server.BaseHTTPRequestHandler):
def do_POST(self):
self.send_response(200)
self.end_headers()
self.wfile.write("server|127.0.0.1\nport|17091\ntype|1\n#maint|Mainetrance message (Not used for now) -- Growtopia Noobs\n\nbeta_server|127.0.0.1\nbeta_port|17091\n\nbeta_type|1\nmeta|localhost\nRTENDMARKERBS1001")
def do_GET(self):
self.send_response(200)
self.end_headers()
self.wfile.write("server|127.0.0.1\nport|17091\ntype|1\n#maint|Mainetrance message (Not used for now) -- Growtopia Noobs\n\nbeta_server|127.0.0.1\nbeta_port|17091\n\nbeta_type|1\nmeta|localhost\nRTENDMARKERBS1001")
def log_message(self, format, *args):
return
PORT = 80
HOST = ""
Handler = http.server.SimpleHTTPRequestHandler,ServerHandler
OUT_HOST = HOST
httpd = socketserver.TCPServer((HOST, PORT), Handler)
print("Server Port : ", PORT)
if OUT_HOST == "" or " " or "\n":
print("Server Hostname : ", "localhost")
else:
print("Server Hostname : ", HOST)
httpd.serve_forever()
我通过将 Handler = http.server.SimpleHTTPRequestHandler
添加到 ServerHandler Class 中解决了这个问题。