From 1a7edf7f0e88c256fba7ddb3ed048aecff1626e2 Mon Sep 17 00:00:00 2001 From: "Dr.Lt.Data" Date: Sat, 1 Feb 2025 11:37:53 +0900 Subject: [PATCH] fixed: datetime.datetime crash - use `hasattr` instead of exception handling https://github.com/ltdrdata/ComfyUI-Manager/issues/1503 --- glob/manager_core.py | 2 +- prestartup_script.py | 10 +++++----- pyproject.toml | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/glob/manager_core.py b/glob/manager_core.py index 79e8e8e0..68bd7f4d 100644 --- a/glob/manager_core.py +++ b/glob/manager_core.py @@ -41,7 +41,7 @@ from node_package import InstalledNodePackage -version_code = [3, 12] +version_code = [3, 12, 1] version_str = f"V{version_code[0]}.{version_code[1]}" + (f'.{version_code[2]}' if len(version_code) > 2 else '') diff --git a/prestartup_script.py b/prestartup_script.py index 217f69c4..c2cce7bb 100644 --- a/prestartup_script.py +++ b/prestartup_script.py @@ -20,13 +20,13 @@ import manager_downloader import folder_paths -try: - from datetime import datetime +import datetime +if hasattr(datetime, 'datetime'): def current_timestamp(): - return datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')[:-3] -except: + return datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')[:-3] +else: + # NOTE: Occurs in some Mac environments. import time - import datetime logging.error(f"[ComfyUI-Manager] fallback timestamp mode\n datetime module is invalid: '{datetime.__file__}'") def current_timestamp(): return str(time.time()).split('.')[0] diff --git a/pyproject.toml b/pyproject.toml index 989564ef..0ffa1b49 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "comfyui-manager" description = "ComfyUI-Manager provides features to install and manage custom nodes for ComfyUI, as well as various functionalities to assist with ComfyUI." -version = "3.12" +version = "3.12.1" license = { file = "LICENSE.txt" } dependencies = ["GitPython", "PyGithub", "matrix-client==0.4.0", "transformers", "huggingface-hub>0.20", "typer", "rich", "typing-extensions"]