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 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 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 diff --git a/requirements.txt b/requirements.txt index a14d5c3..330bff9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,16 +1,14 @@ -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 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 pycparser==2.21 pydub==0.25.1 pyinstaller==5.13.2 @@ -22,17 +20,17 @@ 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 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