Pithikos / python-websocket-server

A simple fully working websocket-server in Python with no external dependencies
MIT License
1.14k stars 384 forks source link

TypeError: str, bytes or bytearray expected, not int #97

Closed urb31075 closed 2 years ago

urb31075 commented 2 years ago

urb@san:~/python-websocket-server$ python3 server.py Traceback (most recent call last): File "server.py", line 22, in server = WebsocketServer(PORT) File "/home/urb/python-websocket-server/websocket_server/websocket_server.py", line 117, in init TCPServer.init(self, (host, port), WebSocketHandler) File "/usr/lib/python3.8/socketserver.py", line 452, in init self.server_bind() File "/usr/lib/python3.8/socketserver.py", line 466, in server_bind self.socket.bind(self.server_address) TypeError: str, bytes or bytearray expected, not int

Diegocndd commented 2 years ago

Put quotation marks around the port. It worked for me.

MuRongPIG commented 2 years ago
PORT=9001
server = WebsocketServer(PORT)

the bug is here (line 21,22). plz change it into:

PORT=9001
server = WebsocketServer(port=PORT)

maybe I'll pull request to solve it.

Pithikos commented 2 years ago

Solved. Fix will be included in next release.