Closed Flaky07 closed 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.
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
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)
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): "
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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
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