From 1c3ab7a116ab5bc3b81d718e6383edd98903a01f Mon Sep 17 00:00:00 2001 From: Trung Ngo Date: Sat, 10 Dec 2022 23:52:39 -0600 Subject: [PATCH] Add trace two common errors to see if more info available --- scripts/image_scorer.py | 3 ++- tools/add_tags.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/image_scorer.py b/scripts/image_scorer.py index b42ec76..d4c88d3 100644 --- a/scripts/image_scorer.py +++ b/scripts/image_scorer.py @@ -1,6 +1,7 @@ import copy from hashlib import md5 import json +import logging import os from modules import sd_samplers, shared, scripts, script_callbacks from modules.script_callbacks import ImageSaveParams @@ -24,7 +25,7 @@ if platform.system() == "Windows" and not is_installed("pywin32"): try: from tools.add_tags import tag_files except: - print(f"{extension_name}: Unable to load Windows tagging script from tools directory") + logging.exception(f"{extension_name}: Unable to load Windows tagging script from tools directory") tag_files = None state_name = "sac+logos+ava1-l14-linearMSE.pth" diff --git a/tools/add_tags.py b/tools/add_tags.py index 785ed39..153a7a2 100644 --- a/tools/add_tags.py +++ b/tools/add_tags.py @@ -1,3 +1,4 @@ +import logging import platform import sys # requires pywin32 (See requirements.txt. Supports Windows only obviously) @@ -69,7 +70,7 @@ def tag_files(files_glob="", tags=[], remove_tags=[], remove_all_tags=False, fil if ps is not None: ps.Commit() except: - print(f"{log_prefix}Unable to write tag or category for {file}") + logging.exception(f"{log_prefix}Unable to write tag or category for {file}") parser = argparse.ArgumentParser() parser.add_argument("-f", "--files-glob", type=str, default="", help="glob pattern to files to tag", required=True)