From 700642a400c2dcaa469ce35b5708e370de42ea13 Mon Sep 17 00:00:00 2001 From: DominikDoom Date: Sat, 13 Apr 2024 20:27:47 +0200 Subject: [PATCH] Attempt to fix import error described in #283 --- scripts/tag_autocomplete_helper.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/tag_autocomplete_helper.py b/scripts/tag_autocomplete_helper.py index d61150e..c2d2f19 100644 --- a/scripts/tag_autocomplete_helper.py +++ b/scripts/tag_autocomplete_helper.py @@ -1,6 +1,7 @@ # This helper script scans folders for wildcards and embeddings and writes them # to a temporary file to expose it to the javascript side +import os import glob import importlib import json @@ -21,7 +22,11 @@ from scripts.model_keyword_support import (get_lora_simple_hash, from scripts.shared_paths import * try: - import scripts.tag_frequency_db as tdb + try: + from scripts import tag_frequency_db as tdb + except ModuleNotFoundError: + sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "scripts"))) + import tag_frequency_db as tdb # Ensure the db dependency is reloaded on script reload importlib.reload(tdb)