pmariglia / showdown

A Pokemon Showdown Battle Bot written in Python
GNU General Public License v3.0
258 stars 176 forks source link

websockets.exceptions.InvalidMessage: did not receive a valid HTTP response #185

Closed zuils closed 2 months ago

zuils commented 9 months ago

Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/websockets/legacy/client.py", line 135, in read_http_response status_code, reason, headers = await read_response(self.reader) File "/usr/local/lib/python3.8/site-packages/websockets/legacy/http.py", line 122, in read_response raise EOFError("connection closed while reading HTTP status line") from exc EOFError: connection closed while reading HTTP status line

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "run.py", line 103, in asyncio.run(showdown()) File "/usr/local/lib/python3.8/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/usr/local/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete return future.result() File "run.py", line 56, in showdown ps_websocket_client = await PSWebsocketClient.create( File "/showdown/showdown/websocket_client.py", line 35, in create self.websocket = await websockets.connect(self.address) File "/usr/local/lib/python3.8/site-packages/websockets/legacy/client.py", line 650, in await_impl_timeout return await asyncio.wait_for(self.await_impl(), self.open_timeout) File "/usr/local/lib/python3.8/asyncio/tasks.py", line 494, in wait_for return fut.result() File "/usr/local/lib/python3.8/site-packages/websockets/legacy/client.py", line 658, in await_impl await protocol.handshake( File "/usr/local/lib/python3.8/site-packages/websockets/legacy/client.py", line 322, in handshake status_code, response_headers = await self.read_http_response() File "/usr/local/lib/python3.8/site-packages/websockets/legacy/client.py", line 141, in read_http_response raise InvalidMessage("did not receive a valid HTTP response") from exc websockets.exceptions.InvalidMessage: did not receive a valid HTTP response

This was using nash_equilibrium and building with docker, never happened to me before

pmariglia commented 8 months ago

weird error - does this consistently happen to you, or was it a fluke?

did not receive a valid HTTP response does not seem like something that this bot can address

If it keeps happening I'd suggest upgrading to at least python 3.10, and then maybe come back with some more information about what PS server you are connecting to.