From 1057301ac053f003cbae8d98f9f5f49d6082252e Mon Sep 17 00:00:00 2001 From: Dollique Date: Sun, 14 Sep 2025 13:06:39 +0200 Subject: [PATCH 1/6] updated python version to 3.12 and added alternative way to install on linux using conda (which fixed some issues for me) --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 361eef1..fd44038 100644 --- a/README.md +++ b/README.md @@ -33,10 +33,17 @@ Create a venv and activate it. ```bash -virtualenv venv --python=python3.7.4 +virtualenv venv --python=python3.12 source venv/bin/activate ``` +or alternatively if you have issues use conda: + +```bash +conda create -n game2text python=3.12 +conda activate game2text +``` + Install requirements: ```bash From ff2e673ec6bb1dc690da11efc2ffe7a1a903501d Mon Sep 17 00:00:00 2001 From: Dollique Date: Sun, 14 Sep 2025 13:08:11 +0200 Subject: [PATCH 2/6] make pynput import optional, which solves an issue on Linux using wayland which did always fall back to x11 --- game2text.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/game2text.py b/game2text.py index 88cad23..306ed94 100644 --- a/game2text.py +++ b/game2text.py @@ -8,7 +8,12 @@ from util import RepeatedTimer, create_directory_if_not_exists, get_default_browser_name, get_PID_list, format_output from textractor import Textractor from tools import path_to_textractor, open_folder_textractor_path -from pynput import keyboard +try: + from pynput import keyboard + _pynput_available = True +except Exception as e: + print(f"[Warning] pynput not available or failed to initialize: {e}\nGlobal hotkeys will be disabled.") + _pynput_available = False from clipboard import clipboard_to_output, text_to_clipboard from logger import get_time_string, log_text, log_media, update_log_text from ankiconnect import invoke, get_anki_models, update_anki_models, create_anki_note, fetch_anki_fields @@ -225,5 +230,13 @@ def run_eel(): clipboard_timer = RepeatedTimer(1, clipboard_to_output) clipboard_timer.stop() # stop the initial timer -with keyboard.GlobalHotKeys(hotkey_map) as listener: - listener.join() \ No newline at end of file + + + +if _pynput_available: + try: + with keyboard.GlobalHotKeys(hotkey_map) as listener: listener.join() + except Exception as e: + print(f"[Warning] Failed to start global hotkeys: {e}\nContinuing without keybindings.") +else: + print("[Info] Global hotkeys are disabled.") \ No newline at end of file From 785e12e17335c693e2761f394b9e105120092247 Mon Sep 17 00:00:00 2001 From: Dollique Date: Sun, 14 Sep 2025 13:09:10 +0200 Subject: [PATCH 3/6] replace fuzzywuzzy with the new repo thefuzz --- gamescript.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gamescript.py b/gamescript.py index 7ba6a8c..5c66ed7 100644 --- a/gamescript.py +++ b/gamescript.py @@ -3,7 +3,7 @@ from tkinter import * from tkinter.filedialog import askopenfile from shutil import copyfile -from fuzzywuzzy import process +from thefuzz import process from config import r_config, w_config, LOG_CONFIG, SCRIPT_MATCH_CONFIG from tools import bundle_dir From 624738113400303e884647876375f42d0eb457cb Mon Sep 17 00:00:00 2001 From: Dollique Date: Sun, 14 Sep 2025 13:10:02 +0200 Subject: [PATCH 4/6] update all dependencies to work on python 3.12 and added some missing dependencies --- requirements.txt | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/requirements.txt b/requirements.txt index a14d5c3..6dc19f2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,16 +1,19 @@ -bottle==0.12.25 +bottle==0.13.4 bottle-websocket==0.2.9 certifi==2020.11.8 -cffi==1.14.4 -Eel==0.16.0 +cffi==2.0.0 +eel==0.18.2 future==0.18.2 -fuzzywuzzy==0.18.0 +googletrans==4.0.2 +h11==0.16.0 +httpcore==1.0.9 +httpx==0.28.1 idna==3.4 -numpy==1.26.0 -opencv-python==4.8.0.76 -parse==1.19.0 -Pillow==10.0.1 -psutil==5.9.5 +opencv-python==4.12.0.88 +parse==1.20.2 +Pillow==10.4.0 +psutil==7.0.0 +PyAudio==0.2.14 pycparser==2.21 pydub==0.25.1 pyinstaller==5.13.2 @@ -22,17 +25,15 @@ pyparsing==2.4.7 pyperclip==1.8.2 pytesseract==0.3.10 python-xlib==0.29 -python-Levenshtein==0.12.2 pywin32-ctypes==0.2.0 PyYAML==6.0.1 -requests==2.31.0 +requests==2.32.5 six==1.16.0 +thefuzz==0.22.1 tk==0.1.0 -transformers==4.27.4 -translators==5.8.3 -urllib3==1.26.2 +translators==6.0.1 +urllib3==2.5.0 whichcraft==0.6.1 -wexpect==4.0.0; sys_platform == 'win32' -wurlitzer>=3.0.2,<4.0.0; sys_platform == 'darwin' +xkbcommon==1.5.1 zope.event==5.0 zope.interface==6.0 From 37a6007861214ed70d280b5291455911690edc41 Mon Sep 17 00:00:00 2001 From: Dollique Date: Sun, 14 Sep 2025 13:10:40 +0200 Subject: [PATCH 5/6] replace fallback chrome with default (tested on a linux machine without chrome installed) --- util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util.py b/util.py index b618c5f..3380a9c 100644 --- a/util.py +++ b/util.py @@ -83,7 +83,7 @@ def get_default_browser_name(): return browser_map[browser] else: return 'chromium' - return 'chrome' + return 'default' def get_PID_list(): if platform.system() == 'Darwin': # Not available for Mac From 2d75f894043f7151578e5929ed02347f9a2c51d1 Mon Sep 17 00:00:00 2001 From: Dollique Date: Sun, 14 Sep 2025 13:55:31 +0200 Subject: [PATCH 6/6] removed unneccessary dependencies and re-added accidentally removed ones --- requirements.txt | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/requirements.txt b/requirements.txt index 6dc19f2..330bff9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,16 +4,11 @@ certifi==2020.11.8 cffi==2.0.0 eel==0.18.2 future==0.18.2 -googletrans==4.0.2 -h11==0.16.0 -httpcore==1.0.9 -httpx==0.28.1 idna==3.4 opencv-python==4.12.0.88 parse==1.20.2 Pillow==10.4.0 psutil==7.0.0 -PyAudio==0.2.14 pycparser==2.21 pydub==0.25.1 pyinstaller==5.13.2 @@ -34,6 +29,8 @@ tk==0.1.0 translators==6.0.1 urllib3==2.5.0 whichcraft==0.6.1 +wexpect==4.0.0; sys_platform == 'win32' +wurlitzer>=3.0.2,<4.0.0; sys_platform == 'darwin' xkbcommon==1.5.1 zope.event==5.0 zope.interface==6.0