Closed infinitewarp closed 10 months ago
Thank you for this fix! I wrote the original method to deal with exactly this problem, but when I was moving things around here it looks like I accidentally broke my own function. Thank you for catching this and I'm sorry for my oversight.
I am not very fluent in Python and I am just now learning of the get
method, which seems to do exactly what I wrote the get_data_safe
function to do, so I might just eliminate it altogether.
I encountered the following error several times today on my first ever time running the "Scan Models for Civitai" functionality in the a1111 UI for this extension.
At the time this exception was raised, the
modelname.civitai.info
file contained only{}
. I discovered that I could manually "fix" the file by replacing it with{"description":""}
and restarting scan would handle the file just fine, but then it choked on another file later that also contained only{}
that I would have to manually fix. (Probably several more after that.) Note that this didn't happen for all models. I'm not sure why some got an empty{}
while others worked just fine, but I didn't want to chase down that problem too. πSo, this PR fixes
get_data_safe
so that it actually handlesKeyError
or any other exception. I'm not a fan of the unspecifiedexcept
, but I think I implemented whatever the original author intended this function to do, and that's good enough for now.I was able to successfully complete "Scan Models for Civitai" without errors after making this change.
π