Using OCR on an M1 Mac causes "image not found"
Hey Matthew 👋
Love the project! Such a wonderfully fast and easy-to-use alternative to VN OCR. Running it on my Windows machine has been a breeze, but when trying it out on my M1 Macbook, it seemed to never replace the body text saying "Drag and encircle the text portion of the game." This occurs using any OCR engine.
The logs appear to say that an image is not being found, which I assume is related to #32, but wanted to make an issue to be sure.
Here is the full trace, if it helps you troubleshoot:
Traceback (most recent call last):
File "src/gevent/greenlet.py", line 906, in gevent._gevent_cgreenlet.Greenlet.run
File "eel/__init__.py", line 259, in _process_message
File "game2text.py", line 32, in recognize_image
File "ocr.py", line 19, in detect_and_log
File "ocr.py", line 36, in image_to_text
File "ocr.py", line 50, in tesseract_ocr
File "pytesseract/pytesseract.py", line 374, in image_to_string
File "pytesseract/pytesseract.py", line 373, in <lambda>
File "pytesseract/pytesseract.py", line 282, in run_and_get_output
File "pytesseract/pytesseract.py", line 258, in run_tesseract
pytesseract.pytesseract.TesseractError: (-6, 'dyld: Library not loaded: ../../../leptonica/1.80.0/lib/liblept.5.dylib Referenced from: /Applications/game2text.app/Contents/MacOS/resources/bin/mac/tesseract/4.1.1/bin/tesseract Reason: image not found')
2021-10-06T23:00:55Z <Greenlet at 0x7fa65bc81dd0: _process_message({'call': 31.117313978390253, 'name': 'recognize_im, <geventwebsocket.websocket.WebSocket object at 0x7)> failed with TesseractError
I'm happy to try anything on my end if you don't have the necessary hardware. Let me know! 😄
The packaged Tesseract can't be used for M1 Mac and you would need to install it separately through brew and then changing the location of tesseract in tools.py to where tesseract is installed. (You can find where tesseract is with 'which tesseract')
I have an M1 air that could run Game2text but I didn't package it for an official release because it would crash after a while for no apparent reason and I have yet to figure out the reason.
Currently, there are other issues with tkinter and file dialogs on Mac so avoid selecting game scripts from folder or selecting image filter from folder. A migration to using browser file dialogs is a solution but obviously that would then require giving the browser folder access rights.
The packaged Tesseract can't be used for M1 Mac and you would need to install it separately through brew and then changing the location of tesseract in tools.py to where tesseract is installed. (You can find where tesseract is with 'which tesseract')
I have an M1 air that could run Game2text but I didn't package it for an official release because it would crash after a while for no apparent reason and I have yet to figure out the reason.
Currently, there are other issues with tkinter and file dialogs on Mac so avoid selecting game scripts from folder or selecting image filter from folder. A migration to using browser file dialogs is a solution but obviously that would then require giving the browser folder access rights.
How do we go about changing the location of the tesseract? I'm not sure where to find/change tools.py?
The packaged Tesseract can't be used for M1 Mac and you would need to install it separately through brew and then changing the location of tesseract in tools.py to where tesseract is installed. (You can find where tesseract is with 'which tesseract') I have an M1 air that could run Game2text but I didn't package it for an official release because it would crash after a while for no apparent reason and I have yet to figure out the reason. Currently, there are other issues with tkinter and file dialogs on Mac so avoid selecting game scripts from folder or selecting image filter from folder. A migration to using browser file dialogs is a solution but obviously that would then require giving the browser folder access rights.
How do we go about changing the location of the tesseract? I'm not sure where to find/change tools.py?
You need to download the entire repository.