TeamFightTacticsBots / Alune

Mobile TFT Bot - Automate Teamfight Tactics in the mobile version through emulators, to farm pass exp and event tokens.
GNU Affero General Public License v3.0
59 stars 9 forks source link

Got to the last step and have this error #2

Closed Alexlovesapples closed 7 months ago

Alexlovesapples commented 7 months ago

Traceback (most recent call last): File "C:\WINDOWS\system32\Alune\alune-venv\Lib\site-packages\adb_shell\transport\tcp_transport_async.py", line 106, in bulk_read async with async_timeout.timeout(transport_timeout_s): File "C:\WINDOWS\system32\Alune\alune-venv\Lib\site-packages\async_timeout__init.py", line 141, in aexit self._do_exit(exc_type) File "C:\WINDOWS\system32\Alune\alune-venv\Lib\site-packages\async_timeout\init__.py", line 228, in _do_exit raise asyncio.TimeoutError TimeoutError

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

Traceback (most recent call last): File "C:\WINDOWS\system32\Alune\main.py", line 361, in asyncio.run(main()) File "C:\Users\Apples\AppData\Local\Programs\Python\Python312\Lib\asyncio\runners.py", line 194, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "C:\Users\Apples\AppData\Local\Programs\Python\Python312\Lib\asyncio\runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Apples\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 687, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "C:\WINDOWS\system32\Alune\main.py", line 353, in main await check_phone_preconditions(adb_instance) File "C:\WINDOWS\system32\Alune\main.py", line 306, in check_phone_preconditions size = await adb_instance.get_screen_size() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\WINDOWS\system32\Alune\alune\adb.py", line 99, in get_screen_size shell_output = await self._device.shell("wm size | awk 'END{print $3}'") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\WINDOWS\system32\Alune\alune-venv\Lib\site-packages\adb_shell\adb_device_async.py", line 881, in shell return await self._service(b'shell', command.encode('utf8'), transport_timeout_s, read_timeout_s, timeout_s, decode) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\WINDOWS\system32\Alune\alune-venv\Lib\site-packages\adb_shell\adb_device_async.py", line 749, in _service return b''.join([x async for x in self._streaming_command(service, command, transport_timeout_s, read_timeout_s, timeout_s)]).decode('utf8', 'backslashreplace') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\WINDOWS\system32\Alune\alune-venv\Lib\site-packages\adb_shell\adb_device_async.py", line 1327, in _streaming_command adb_info = await self._open(b'%s:%s' % (service, command), transport_timeout_s, read_timeout_s, timeout_s) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\WINDOWS\system32\Alune\alune-venv\Lib\site-packages\adb_shell\adb_device_async.py", line 1225, in open , adb_info.remoteid, , _ = await self._io_manager.read([constants.OKAY], adb_info) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\WINDOWS\system32\Alune\alune-venv\Lib\site-packages\adb_shell\adb_device_async.py", line 376, in read cmd, arg0, arg1, data = await self._read_packet_from_device(adb_info) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\WINDOWS\system32\Alune\alune-venv\Lib\site-packages\adb_shell\adb_device_async.py", line 523, in _read_packet_from_device msg = await self._read_bytes_from_device(constants.MESSAGE_SIZE, adb_info) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\WINDOWS\system32\Alune\alune-venv\Lib\site-packages\adb_shell\adb_device_async.py", line 479, in _read_bytes_from_device temp = await self._transport.bulk_read(length, adb_info.transport_timeout_s) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\WINDOWS\system32\Alune\alune-venv\Lib\site-packages\adb_shell\transport\tcp_transport_async.py", line 110, in bulk_read raise TcpTimeoutException(msg) from exc adb_shell.exceptions.TcpTimeoutException: Reading from localhost:5555 timed out (9 seconds)

akshualy commented 7 months ago

Hey, it seems there is an ADB device on port 5555, but it is not responding to our commands. Could you tell me which emulator you are using?

Kyrluckechuck commented 7 months ago

Odd that this didn't get caught by https://github.com/TeamFightTacticsBots/Alune/blob/2430f2a920885c0735e19ef3cee2cc1762dd4fbb/main.py#L348, since that should have aborted the bot prior to this checking the phone dimensions šŸ¤”

Alexlovesapples commented 7 months ago

I was using the bluestacks emulator

Alexlovesapples commented 7 months ago

These are the lines before the error above: python main.py 2024-04-22 10:34:44.716 | INFO | alune.adb:_connect_to_device:69 - Attempting to connect to ADB session with device localhost:5555 2024-04-22 10:34:46.727 | DEBUG | main:main:352 - ADB is connected, checking phone and app details 2024-04-22 10:34:46.727 | DEBUG | main:check_phone_preconditions:305 - Checking screen size

akshualy commented 7 months ago

Odd that this didn't get caught by

https://github.com/TeamFightTacticsBots/Alune/blob/2430f2a920885c0735e19ef3cee2cc1762dd4fbb/main.py#L348 , since that should have aborted the bot prior to this checking the phone dimensions šŸ¤”

I don't have the exact adb specification in mind, but I do believe a connection is separate from the shell.

My only guess is that something else is accepting connections on port 5555, but isn't actually reachable for commands. Assuming you're on windows, can you

  1. Start your BlueStacks emulator which you try to run TFT on
  2. Open a command prompt and check the output of the command netstat -fnao | findstr 555

If there's something with :5556, try changing 5555 to 5556 in alune/adb.py line 63

Alexlovesapples commented 7 months ago

upon entering that command I get this response: netstat -fnao | findstr 555 TCP 127.0.0.1:5555 0.0.0.0:0 LISTENING 4960 looks like it is 5555

akshualy commented 7 months ago

I was able to reproduce this, it seems this happens if you do not have ADB enabled in BlueStacks. Please go to the settings and check the Android Debug Bridge (ADB) box under Advanced, then save the changes. Then try again :)

Kyrluckechuck commented 7 months ago

Ahhh -- I had assumed that was a given. We should update the docs accordingly to indicate this is necessary šŸ˜…

Alexlovesapples commented 7 months ago

thanks for the assist!