harrischristiansen/generals-bot

connect error

Closed this issue · 1 comments

I run with python bot_blob.py -g ffa, got errors ad follow:

pygame 2.1.2 (SDL 2.0.18, Python 3.9.6)
Hello from the pygame community. https://www.pygame.org/contribute.html
DEBUG:root:Creating connection
Send Msg:Exception in thread Thread-1:
Traceback (most recent call last):
File "C:\Users\Nuclear_Missile\AppData\Local\Programs\Python\Python39\lib\threading.py", line 973, in _bootstrap_inner
self.run()
File "C:\Users\Nuclear_Missile\AppData\Local\Programs\Python\Python39\lib\threading.py", line 910, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\Nuclear_Missile\Desktop\generals-bot-master\base\bot_base.py", line 53, in _start_game_thread
self._game = generals.Generals(self._name, self._name, self._gameType, gameid=self._privateRoomID, public_server=self._public_server)
File "C:\Users\Nuclear_Missile\Desktop\generals-bot-master\base\client\generals.py", line 20, in init
self._connect_and_join(userid, username, mode, gameid, force_start, public_server)
File "C:\Users\Nuclear_Missile\Desktop\generals-bot-master\base\client\generals.py", line 170, in _connect_and_join
self._ws = create_connection(ENDPOINT_BOT if not public_server else ENDPOINT_PUBLIC)
File "C:\Users\Nuclear_Missile\AppData\Local\Programs\Python\Python39\lib\site-packages\websocket_core.py", line 606, in create_connection
websock.connect(url, **options)
File "C:\Users\Nuclear_Missile\AppData\Local\Programs\Python\Python39\lib\site-packages\websocket_core.py", line 253, in connect
self.handshake_response = handshake(self.sock, url, *addrs, **options)
File "C:\Users\Nuclear_Missile\AppData\Local\Programs\Python\Python39\lib\site-packages\websocket_handshake.py", line 57, in handshake
status, resp = _get_resp_headers(sock)
File "C:\Users\Nuclear_Missile\AppData\Local\Programs\Python\Python39\lib\site-packages\websocket_handshake.py", line 146, in _get_resp_headers
status, resp_headers, status_message = read_headers(sock)
File "C:\Users\Nuclear_Missile\AppData\Local\Programs\Python\Python39\lib\site-packages\websocket_http.py", line 313, in read_headers
line = recv_line(sock)
File "C:\Users\Nuclear_Missile\AppData\Local\Programs\Python\Python39\lib\site-packages\websocket_socket.py", line 134, in recv_line
c = recv(sock, 1)
File "C:\Users\Nuclear_Missile\AppData\Local\Programs\Python\Python39\lib\site-packages\websocket_socket.py", line 125, in recv
raise WebSocketConnectionClosedException(
websocket._exceptions.WebSocketConnectionClosedException: Connection to remote host was lost.

Exception in thread Thread-2:
Traceback (most recent call last):
File "C:\Users\Nuclear_Missile\AppData\Local\Programs\Python\Python39\lib\threading.py", line 973, in _bootstrap_inner
self.run()
File "C:\Users\Nuclear_Missile\AppData\Local\Programs\Python\Python39\lib\threading.py", line 910, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\Nuclear_Missile\Desktop\generals-bot-master\base\bot_base.py", line 109, in _start_chat_thread
self._game.send_chat(msg)
AttributeError: 'GeneralsBot' object has no attribute '_game'

I think it's probably the connecting ways is changed, because the code on the website can hardly connect it.

This is caused by generals moving to SSL. I have disabled SSL cert check in 4a16456 and you should be able to connect again.