Closed stephantual closed 8 months ago
thanks for reporting this. looks like this is happening because I totally forgot about windows, my bad. The error happens while trying to save the fetched information into db.json
The path that its searching for works on linux
and macos
. I currently don't have comfy ui installed anymore and am taking a break from SD for a bit but am more than happy to resolve this issue.
if you don't mind being a "test subject", can you go into the lora-info
folder and edit lora-info.py
lines 46 and 99 contain the path:
'./custom_nodes/lora-info/db.json'
change this to:
'custom_nodes/lora-info/db.json'
and it should work. If it does work, I'll go ahead and update the node with the changes.
@stephantual , I've pushed an update that should resolve this and use paths in a more cross-platform way, feel free to reopen if this is not resolved.
also side note: if you've created an empty db.json file, please do delete it before testing, or set the contents to:
{}
Just tried - updated (twice) around 5 minutes ago and still throws an error. Tried with the file deleted, and tried with the file existing but containing only {} using sublime text editor. I get the same error. Not a biggy but worth noting.
did the error message change after you updated?
@stephantual I've pushed another update where the path is completely resolved instead of using a relative path. I'm hoping this resolves the issue. I'll leave this ticket open until I have confirmation this is resolved. unfortunately I don't have a windows computer with me right now so I'm unable to test on windows
just updated and tried it on win 11, gives the same error (error saving json to file)
just updated and tried it on win 11, gives the same error (error saving json to file)
thanks for testing, can you copy paste the error message in here?
thanks for testing, can you copy paste the error message in here?
Sure! here it is:
_File not found: C:\ComfyUI_windows_portable\custom_nodes\lora-info\db.json Error saving JSON to file: [Errno 2] No such file or directory: 'C:\ComfyUI_windows_portable\customnodes\lora-info\db.json'
thanks for testing, can you copy paste the error message in here?
Sure! here it is:
_File not found: C:\ComfyUI_windows_portable\custom_nodes\lora-info\db.json Error saving JSON to file: [Errno 2] No such file or directory: 'C:\ComfyUI_windows_portable\customnodes\lora-info\db.json'
thanks. is the beginning of the path correct? ie. is there in fact a ComfyUI_windows_portable folder in your C: drive? or is the node detecting a bad path?
Sure! here it is: _File not found: C:\ComfyUI_windows_portable\custom_nodes\lora-info\db.json Error saving JSON to file: [Errno 2] No such file or directory: 'C:\ComfyUI_windows_portable\customnodes\lora-info\db.json'
thanks. is the beginning of the path correct? ie. is there in fact a ComfyUI_windows_portable folder in your C: drive? or is the node detecting a bad path?
Yes, comfyui is located in C: drive but i think the node is missing a folder in the path. The original path should be like this _"C:\ComfyUI_windows_portable\ComfyUI\customnodes\lora-info" By the way I checked this folder but there is no "db.json" FYI...
Sure! here it is: _File not found: C:\ComfyUI_windows_portable\custom_nodes\lora-info\db.json Error saving JSON to file: [Errno 2] No such file or directory: 'C:\ComfyUI_windows_portable\customnodes\lora-info\db.json'
thanks. is the beginning of the path correct? ie. is there in fact a ComfyUI_windows_portable folder in your C: drive? or is the node detecting a bad path?
Yes, comfyui is located in C: drive but i think the node is missing a folder in the path. The original path should be like this _"C:\ComfyUI_windows_portable\ComfyUI\customnodes\lora-info" By the way I checked this folder but there is no "db.json" FYI...
yeah the error message is a bit miss leading, even though it says "file not found", what its really complaining about is the folder/path not existing. this happens while its trying to create the file.
Thanks for the above information this helps a lot. I have another fix in mind that should finally resolve this. will update shortly
@mcanemre ok, I've pushed a change that should hopefully resolve. It looks at where the node's script is and resolves a full path according to where it is and then adds db.json
to it.
please let me know if this finally resolves the issue.
Thank you @jitcoder . I'm currently away on a trip and can't check but I'll do so on my return. Thank you for your help.
Hello! I'm getting the same error on Windows 11.
File not found: E:\ComfyUI_portable\ComfyUI\custom_nodes\lora-info\db.json
This happens when ComfyUI initially loads.
On line 50 you call db = load_json_from_file(db_path)
which goes into the function load_json_from_file
on line 13.
Here, you are just throwing an error if file isn't found. The issue is, your repo doesn't contain a db.json file and you are not creating one in the code. So the db.json is not found and not created and the error persists.
Easiest solution seems to be to just push a db.json file with contents set to {}
.
If I create it manually that error goes away.
Additionally, if db.json contents is just an empty object, there are additional errors on startup until you select a Lora and populate the db. Afterwards, there are no more errors.
Hope this helps some and great node!
I think this is resolved now, if anyone is running into this with the latest please let me know and I will re-open
@jitcoder After I put the empty db.json file as instructed but then I got this issue:
Error handling request Traceback (most recent call last): File "D:\Comfy\venv\lib\site-packages\aiohttp\web_protocol.py", line 452, in _handle_request resp = await request_handler(request) File "D:\Comfy\venv\lib\site-packages\aiohttp\web_app.py", line 543, in _handle resp = await handler(request) File "D:\Comfy\venv\lib\site-packages\aiohttp\web_middlewares.py", line 114, in impl return await handler(request) File "D:\Comfy\ComfyUI\server.py", line 47, in cache_control response: web.Response = await handler(request) File "D:\Comfy\ComfyUI\custom_nodes\lora-info\lora_info.py", line 112, in fetch_lora_info (output, triggerWords, examplePrompt, baseModel) = get_lora_info(lora_name) File "D:\Comfy\ComfyUI\custom_nodes\lora-info\lora_info.py", line 68, in get_lora_info LORAsha256 = calculate_sha256(lora_path) File "D:\Comfy\ComfyUI\custom_nodes\lora-info\lora_info.py", line 43, in calculate_sha256 with open(file_path, "rb") as f: TypeError: expected str, bytes or os.PathLike object, not NoneType
Thank you for this useful node! One little issue:
Installed using comfy ui manager. Default workflow, just stick lora info in there on the screen. Queue.
I tried creating an empty json file but it doens't silence it. I imagine it's a permission issue, running windows 11 and comfy portable.
Thank you!