There is an error when running the script, on Windows machines, if the model name ends with a whitespace (%20).
Python tells windows to create the path, but windows remove the trailing whitespace, and when you try to save files in it, it breaks, because the path with a whitespace in the end is not found.
You can see that for the user "EDG", they currently have a LyCoris (other cathegory) named "SDoom 2.1 " (trailing whitespace character. It fails with the following error:
Error downloading https://civitai.com/api/download/models/37280?token=&nsfw=true: [Errno 2] No such file or directory: 'model_downloads\EDG\Other\SDoom2.1 \DOOM21.safetensors'. Retrying in 10 seconds (attempt 2).
Traceback (most recent call last):
File "\CivitAI-Model-grabber\civitAI_Model_downloader.py", line 387, in
process_username(username, download_type)
File "\CivitAI-Model-grabber\civitAI_Model_downloader.py", line 369, in process_username
future.result()
File "\Python310\lib\concurrent\futures_base.py", line 458, in result
return self.get_result()
File "\Python310\lib\concurrent\futures_base.py", line 403, in get_result
raise self._exception
File "\Python310\lib\concurrent\futures\thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "\CivitAI-Model-grabber\civitAI_Model_downloader.py", line 252, in download_model_files
with open(details_file, "a", encoding='utf-8') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'model_downloads\EDG\Other\SDoom2.1 \details.txt'
I worked around it by adding ".strip()" to every line in "sanitize_name" that touched "name", "folder_name" and "base_name". For sure, I have too many of them, but it got it working.
thanks for the bugreport and the hint what the problem is and what i could change. I have added a new function that removes whitespaces at the end. so nothing had to be changed in the sanitize_name.
There is an error when running the script, on Windows machines, if the model name ends with a whitespace (%20). Python tells windows to create the path, but windows remove the trailing whitespace, and when you try to save files in it, it breaks, because the path with a whitespace in the end is not found.
You can see that for the user "EDG", they currently have a LyCoris (other cathegory) named "SDoom 2.1 " (trailing whitespace character. It fails with the following error:
Error downloading https://civitai.com/api/download/models/37280?token=&nsfw=true: [Errno 2] No such file or directory: 'model_downloads\EDG\Other\SDoom2.1 \DOOM21.safetensors'. Retrying in 10 seconds (attempt 2).
Traceback (most recent call last):
File "\CivitAI-Model-grabber\civitAI_Model_downloader.py", line 387, in
process_username(username, download_type)
File "\CivitAI-Model-grabber\civitAI_Model_downloader.py", line 369, in process_username
future.result()
File "\Python310\lib\concurrent\futures_base.py", line 458, in result
return self.get_result()
File "\Python310\lib\concurrent\futures_base.py", line 403, in get_result
raise self._exception
File "\Python310\lib\concurrent\futures\thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "\CivitAI-Model-grabber\civitAI_Model_downloader.py", line 252, in download_model_files
with open(details_file, "a", encoding='utf-8') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'model_downloads\EDG\Other\SDoom2.1 \details.txt'
I worked around it by adding ".strip()" to every line in "sanitize_name" that touched "name", "folder_name" and "base_name". For sure, I have too many of them, but it got it working.