我已经使用 ws4py 0.3.2 创建了一个 Web 服务器套接字,它在 python 3.3.2 上使用了 cherrypy 3.2.4。当我尝试像这样打印客户端发送到服务器的消息时
class ChatWebSocketHandler(WebSocket):
def received_message(self, m):
cherrypy.log("[+] Message => {%d} %s" % (len(m), m))
cherrypy.engine.publish('websocket-broadcast', m)
我收到错误消息:
File "./server.py", line 13, in received_message
cherrypy.log("[+] Message => {%d} %s" % (len(m), m))
TypeError: __str__ returned non-string (type bytes)