[GH-ISSUE #1517] AttributeError("type object 'datetime.datetime' has no attribute 'datetime'") #640

Closed
opened 2026-10-27 21:20:17 +00:00 by bsakaguchi · 4 comments
Owner

Originally created by @cjhmdm on GitHub (Feb 4, 2025).
Original GitHub issue: https://github.com/Comfy-Org/ComfyUI-Manager/issues/1517

The following errors from a fresh install (neither of these has ever been installed on this machine) of the latest version of ComfyUI Desktop (v0.4.16). After initial install, cloned latest version of ComfyUI-Manager (3.17.7) and receive the errors below.

OS: Windows 11 Pro 24H2

## ComfyUI-Manager: installing dependencies done.
** ComfyUI startup time: 
[2025-02-04 08:27:31.483] [info]  2025-02-04 08:27:31.482
** Platform: Windows
** Python version: 3.12.8 (main, Dec 19 2024, 14:41:01) [MSC v.1942 64 bit (AMD64)]
** Python executable: C:\Users\chris\Documents\ComfyUI\.venv\Scripts\python.exe
** ComfyUI Path: C:\Users\chris\AppData\Local\Programs\@comfyorgcomfyui-electron\resources\ComfyUI
** ComfyUI Base Folder Path: C:\Users\chris\AppData\Local\Programs\@comfyorgcomfyui-electron\resources\ComfyUI
** User directory: C:\Users\chris\Documents\ComfyUI\user
** ComfyUI-Manager config path: C:\Users\chris\Documents\ComfyUI\user\default\ComfyUI-Manager\config.ini
** Log path: C:\Users\chris\Documents\ComfyUI\user\comfyui.log

[2025-02-04 08:27:32.096] [info]  [START] Security scan

[2025-02-04 08:27:32.660] [info]  [DONE] Security scan

[2025-02-04 08:27:32.661] [error] Failed to execute startup-script: C:\Users\chris\AppData\Local\Programs\@comfyorgcomfyui-electron\resources\ComfyUI\custom_nodes\ComfyUI-Manager\prestartup_script.py / type object 'datetime.datetime' has no attribute 'datetime'

[2025-02-04 08:27:32.661] [error] object address  : 00000235F62EC660
object refcount : 3
object type     : 00007FFED1472270
object type name: AttributeError
object repr     : AttributeError("type object 'datetime.datetime' has no attribute 'datetime'")
lost sys.stderr
Originally created by @cjhmdm on GitHub (Feb 4, 2025). Original GitHub issue: https://github.com/Comfy-Org/ComfyUI-Manager/issues/1517 The following errors from a fresh install (neither of these has ever been installed on this machine) of the latest version of ComfyUI Desktop (v0.4.16). After initial install, cloned latest version of ComfyUI-Manager (3.17.7) and receive the errors below. OS: Windows 11 Pro 24H2 ``` ## ComfyUI-Manager: installing dependencies done. ** ComfyUI startup time: [2025-02-04 08:27:31.483] [info] 2025-02-04 08:27:31.482 ** Platform: Windows ** Python version: 3.12.8 (main, Dec 19 2024, 14:41:01) [MSC v.1942 64 bit (AMD64)] ** Python executable: C:\Users\chris\Documents\ComfyUI\.venv\Scripts\python.exe ** ComfyUI Path: C:\Users\chris\AppData\Local\Programs\@comfyorgcomfyui-electron\resources\ComfyUI ** ComfyUI Base Folder Path: C:\Users\chris\AppData\Local\Programs\@comfyorgcomfyui-electron\resources\ComfyUI ** User directory: C:\Users\chris\Documents\ComfyUI\user ** ComfyUI-Manager config path: C:\Users\chris\Documents\ComfyUI\user\default\ComfyUI-Manager\config.ini ** Log path: C:\Users\chris\Documents\ComfyUI\user\comfyui.log [2025-02-04 08:27:32.096] [info] [START] Security scan [2025-02-04 08:27:32.660] [info] [DONE] Security scan [2025-02-04 08:27:32.661] [error] Failed to execute startup-script: C:\Users\chris\AppData\Local\Programs\@comfyorgcomfyui-electron\resources\ComfyUI\custom_nodes\ComfyUI-Manager\prestartup_script.py / type object 'datetime.datetime' has no attribute 'datetime' [2025-02-04 08:27:32.661] [error] object address : 00000235F62EC660 object refcount : 3 object type : 00007FFED1472270 object type name: AttributeError object repr : AttributeError("type object 'datetime.datetime' has no attribute 'datetime'") lost sys.stderr ```
Author
Owner

@cjhmdm commented on GitHub (Feb 4, 2025):

Resolved this locally by making the following changes:

C:\Users\chris\Documents\ComfyUI\custom_nodes\ComfyUI-Manager\prestartup_script.py
changed import datetime to from datetime import datetime
and return datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')[:-3] to return datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')[:-3]

and
C:\Users\chris\AppData\Local\Programs@comfyorgcomfyui-electron\resources\ComfyUI\custom_nodes\ComfyUI-Manager\prestartup_script.py
changed import datetime to from datetime import datetime
and timestamp = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')[:-3] to timestamp = datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')[:-3]
and print("** ComfyUI startup time:", datetime.datetime.now()) to print("** ComfyUI startup time:", datetime.now())

Note: I am unsure if the above changes causes any issues anywhere else as I'm reporting back as I go.

<!-- gh-comment-id:2634021350 --> @cjhmdm commented on GitHub (Feb 4, 2025): Resolved this locally by making the following changes: C:\Users\chris\Documents\ComfyUI\custom_nodes\ComfyUI-Manager\prestartup_script.py changed `import datetime` to `from datetime import datetime` and `return datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')[:-3]` to `return datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')[:-3]` and C:\Users\chris\AppData\Local\Programs\@comfyorgcomfyui-electron\resources\ComfyUI\custom_nodes\ComfyUI-Manager\prestartup_script.py changed `import datetime` to `from datetime import datetime` and `timestamp = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')[:-3]` to `timestamp = datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')[:-3]` and `print("** ComfyUI startup time:", datetime.datetime.now())` to `print("** ComfyUI startup time:", datetime.now())` **Note: I am unsure if the above changes causes any issues anywhere else as I'm reporting back as I go.**
Author
Owner

@Explyy commented on GitHub (Feb 5, 2025):

I couldn't fix it your way, unfortunately mine don't connect to server after applying your fix...

<!-- gh-comment-id:2637874021 --> @Explyy commented on GitHub (Feb 5, 2025): I couldn't fix it your way, unfortunately mine don't connect to server after applying your fix...
Author
Owner

@GalacticF commented on GitHub (Feb 6, 2025):

I couldn't fix it your way, unfortunately mine don't connect to server after applying your fix...
Same for me

<!-- gh-comment-id:2639395035 --> @GalacticF commented on GitHub (Feb 6, 2025): > I couldn't fix it your way, unfortunately mine don't connect to server after applying your fix... Same for me
Author
Owner

@ltdrdata commented on GitHub (Feb 7, 2025):

This is fixed

<!-- gh-comment-id:2641490355 --> @ltdrdata commented on GitHub (Feb 7, 2025): This is fixed
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Comfy-Org/ComfyUI-Manager#640
No description provided.