fixed: robust datetime error

- support fallback timestamp mode

https://forum.comfy.org/t/restarting-comfyui-using-comfyui-manager-will-cause-it-to-fail-to-start/1090
This commit is contained in:
Dr.Lt.Data 2025-01-12 02:23:52 +09:00
parent c5d8a1b3ad
commit 9578ce0820
3 changed files with 15 additions and 5 deletions

View File

@ -41,7 +41,7 @@ import manager_downloader
from node_package import InstalledNodePackage from node_package import InstalledNodePackage
version_code = [3, 6, 4] version_code = [3, 6, 5]
version_str = f"V{version_code[0]}.{version_code[1]}" + (f'.{version_code[2]}' if len(version_code) > 2 else '') version_str = f"V{version_code[0]}.{version_code[1]}" + (f'.{version_code[2]}' if len(version_code) > 2 else '')

View File

@ -17,9 +17,19 @@ import security_check
import manager_util import manager_util
import cm_global import cm_global
import manager_downloader import manager_downloader
from datetime import datetime
import folder_paths import folder_paths
try:
from datetime import datetime
def current_timestamp():
return datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')[:-3]
except:
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]
security_check.security_check() security_check.security_check()
cm_global.pip_blacklist = ['torch', 'torchsde', 'torchvision'] cm_global.pip_blacklist = ['torch', 'torchsde', 'torchvision']
@ -235,7 +245,7 @@ try:
def sync_write(self, message, file_only=False): def sync_write(self, message, file_only=False):
with log_lock: with log_lock:
timestamp = datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')[:-3] timestamp = current_timestamp()
if self.last_char != '\n': if self.last_char != '\n':
log_file.write(message) log_file.write(message)
else: else:
@ -339,7 +349,7 @@ except:
print("## [ERROR] ComfyUI-Manager: GitPython package seems to be installed, but failed to load somehow. Make sure you have a working git client installed") print("## [ERROR] ComfyUI-Manager: GitPython package seems to be installed, but failed to load somehow. Make sure you have a working git client installed")
print("** ComfyUI startup time:", datetime.now()) print("** ComfyUI startup time:", current_timestamp())
print("** Platform:", platform.system()) print("** Platform:", platform.system())
print("** Python version:", sys.version) print("** Python version:", sys.version)
print("** Python executable:", sys.executable) print("** Python executable:", sys.executable)

View File

@ -1,7 +1,7 @@
[project] [project]
name = "comfyui-manager" 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." description = "ComfyUI-Manager provides features to install and manage custom nodes for ComfyUI, as well as various functionalities to assist with ComfyUI."
version = "3.6.4" version = "3.6.5"
license = { file = "LICENSE.txt" } license = { file = "LICENSE.txt" }
dependencies = ["GitPython", "PyGithub", "matrix-client==0.4.0", "transformers", "huggingface-hub>0.20", "typer", "rich", "typing-extensions"] dependencies = ["GitPython", "PyGithub", "matrix-client==0.4.0", "transformers", "huggingface-hub>0.20", "typer", "rich", "typing-extensions"]