jfd02 / TFT-OCR-BOT

A bot that plays Teamfight Tactics using OCR. Keeps track of bench, board, items, and plays the user defined team comp.
GNU General Public License v3.0
323 stars 91 forks source link

Procces -1 crash #223

Closed Flaky07 closed 1 year ago

Flaky07 commented 1 year ago

ttached error log:

" Process Process-1: Traceback (most recent call last): File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1520.0_x64qbz5n2kfra8p0\Lib\multiprocessing\process.py", line 314, in _bootstrap self.run() File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1520.0_x64__qbz5n2kfra8p0\Lib\multiprocessing\process.py", line 108, in run self._target(*self._args, **self._kwargs) File "g:\Scripts\Python\TFT-OCR-BOT\main.py", line 16, in game_loop Game(ui_queue) File "g:\Scripts\Python\TFT-OCR-BOT\game.py", line 34, in init__ self.loading_screen() File "g:\Scripts\Python\TFT-OCR-BOT\game.py", line 61, in loading_screen while game_functions.get_round() != "1-1": ^^^^^^^^^^^^^^^^^^^^^^^^^^ game_round: str = ocr.get_text_from_image(image=round_two, whitelist=ocr.ROUND_WHITELIST)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "g:\Scripts\Python\TFT-OCR-BOT\ocr.py", line 62, in get_text_from_image with PyTessBaseAPI(path=tessdata_path) as api: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "tesserocr.pyx", line 1219, in tesserocr._tesserocr.PyTessBaseAPI.cinit File "tesserocr.pyx", line 1233, in tesserocr._tesserocr.PyTessBaseAPI._init_api RuntimeError: Failed to init API, possibly an invalid tessdata path: G:\Scripts\Python\TFT-OCR-BOT\tesserocr-2.6.0-cp311-cp311-win_amd64.whl Traceback (most recent call last): File "g:\Scripts\Python\TFT-OCR-BOT\main.py", line 29, in overlay.ui_loop() File "g:\Scripts\Python\TFT-OCR-BOT\ui.py", line 75, in ui_loop self.root.mainloop() File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1520.0_x64qbz5n2kfra8p0\Lib\tkinter\init.py", line 1485, in mainloop self.tk.mainloop(n) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1520.0_x64qbz5n2kfra8p0\Lib\tkinter__init.py", line 1943, in call def call__(self, *args): "

I have also had problems installing win32gui

" Installing build dependencies ... done Getting requirements to build wheel ... error error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> [22 lines of output] Traceback (most recent call last): File "C:\Users\Franco\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 353, in

main() File "C:\Users\Franco\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main json_out['return_val'] = hook(**hook_input['kwargs']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Franco\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel return hook(config_settings) ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Franco\AppData\Local\Temp\pip-build-env-fyjs29qd\overlay\Lib\site-packages\setuptools\build_meta.py", line 355, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=['wheel']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Franco\AppData\Local\Temp\pip-build-env-fyjs29qd\overlay\Lib\site-packages\setuptools\build_meta.py", line 325, in _get_build_requires self.run_setup() File "C:\Users\Franco\AppData\Local\Temp\pip-build-env-fyjs29qd\overlay\Lib\site-packages\setuptools\build_meta.py", line 507, in run_setup super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script) File "C:\Users\Franco\AppData\Local\Temp\pip-build-env-fyjs29qd\overlay\Lib\site-packages\setuptools\build_meta.py", line 341, in run_setup exec(code, locals()) File "", line 27, in File "C:\Users\Franco\AppData\Local\Temp\pip-install-8r1_05i3\win32gui_028bd3012a9c4cbd856b7f9640929513\win32\distutils\gui.py", line 6, in from .command import win32_build_ext ModuleNotFoundError: No module named 'win32.distutils.command' [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. error: subprocess-exited-with-error × Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> See above for output. note: This error originates from a subprocess, and is likely not a problem with pip. " ![image](https://github.com/jfd02/TFT-OCR-BOT/assets/49161805/872a7218-a136-400f-90b5-63b3e31aff02)
DonMiller9294 commented 1 year ago

The error messages you provided indicate a couple of issues in your Python project:

Tesseract OCR Error (RuntimeError):

vbnet Copy code RuntimeError: Failed to init API, possibly an invalid tessdata path: G:\Scripts\Python\TFT-OCR-BOT\tesserocr-2.6.0-cp311-cp311-win_amd64.whl This error is related to Tesseract OCR (optical character recognition) and suggests that Tesseract is having trouble initializing due to a potential issue with the tessdata path or the version of Tesseract you're using.

To fix this:

Ensure you have Tesseract installed and that it's in your system's PATH. Make sure the tessdata_path used in your code points to the correct location of Tesseract's data files (trained data files). This path should contain subdirectories like tessdata, which holds the trained language data files. Verify that this path is correct. Double-check the version compatibility between Tesseract, TesserOCR, and your Python version. win32gui Installation Error:

vbnet Copy code ModuleNotFoundError: No module named 'win32.distutils.command' This error occurs when you're trying to install win32gui, which is a Windows-specific library for GUI automation. The error suggests that there's a missing module named 'win32.distutils.command'.

To fix this:

Ensure that you have the pywin32 library installed. You can typically install it using pip:

Copy code pip install pywin32 This library includes win32gui and should resolve the missing module error.

After making these adjustments, try running your Python program again. If you continue to encounter issues, please provide more information about your project's structure and dependencies so that I can offer more specific guidance.

anthony5301 commented 1 year ago

tesserocr-2.6.0-cp311-cp311-win_amd64.whl are the insatall package used in pip, its NOT tessdata, the tessdata path in settings.py should be already correct so dont change it, read and follow the steps here

for the win32gui problem, try run pip install pywin32 in cmd