Confuzu / CivitAI-Model-grabber

The Script Downloads in bulk both model(Lora,Lycoris,Embeding etc..) and related images, from a given CivitAI Username
GNU General Public License v3.0
18 stars 4 forks source link

FileNotFoundError: [Errno 2] No such file or directory #12

Closed ElRandom78 closed 1 month ago

ElRandom78 commented 2 months ago

Hi everyone,

I'm writing to ask if there's any way to fix the error mentioned in the title.

Encountered this error when I tried to download files from user : Chenkin (total of 279 elements)

Below the log:

H:\CONFUZU_CivitAI-Model-grabber\venv\Scripts>activate

(venv) H:\CONFUZU_CivitAI-Model-grabber\venv\Scripts>python civitAI_Model_downloader.py Chenkin
Please enter your Civitai API token: fe112369f9901ce567f29e3db4d380d1
Please enter the type of content to download (Lora, Checkpoints, Embeddings, Other, or All): Lora
Processing username: Chenkin, Download type: Lora
Traceback (most recent call last):
  File "H:\CONFUZU_CivitAI-Model-grabber\venv\Scripts\civitAI_Model_downloader.py", line 355, in <module>                                         | 0.00/75.6M [00:00<?, ?B/s]
    process_username(username, download_type)
  File "H:\CONFUZU_CivitAI-Model-grabber\venv\Scripts\civitAI_Model_downloader.py", line 329, in process_username
    result = future.result()
  File "C:\Users\Francesco\AppData\Local\Programs\Python\Python310\lib\concurrent\futures\_base.py", line 458, in result
    return self.__get_result()
  File "C:\Users\Francesco\AppData\Local\Programs\Python\Python310\lib\concurrent\futures\_base.py", line 403, in __get_result
    raise self._exception
  File "C:\Users\Francesco\AppData\Local\Programs\Python\Python310\lib\concurrent\futures\thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "H:\CONFUZU_CivitAI-Model-grabber\venv\Scripts\civitAI_Model_downloader.py", line 207, in download_model_files
    download_file_or_image(file_url, file_path)
  File "H:\CONFUZU_CivitAI-Model-grabber\venv\Scripts\civitAI_Model_downloader.py", line 116, in download_file_or_image
    with open(output_path, "wb") as file:
FileNotFoundError: [Errno 2] No such file or directory: 'model_downloads\\Chenkin\\Lora\\浦和ハナコ(水着) _ 碧蓝档案 blue archive  \\swhuazi_v1.safetensors'

(venv) H:\CONFUZU_CivitAI-Model-grabber\venv\Scripts>

The problematic file mentioned in the error is at this link: https://civitai.com/models/115301/or-blue-archive

I noticed one thing:

The code create the destination folder for the file, but is empty, as shown below: image

The strangeness, is that the file is available to download in the site, but is like the algorythm can't download the .safetensors file because for him it does not exist.

512681_ef9cb

so, the download remains interrupted in this point.

I tried also this way: 1- I have downloaded manually the missing .safetensors file and I have put it in the empty folder 2-then I have relaunched the downlaod process, but FileNotFoundError: [Errno 2] was raised again, as before, so this wasn't a solution.

In this case, it would be great if the algorythm would do two things: 1)-generate a .txt file as a report with the list of all the URLs of the files that it was unable to download, like this one. (so, in this way, you can find the URL and download the .safetensors file manually later):

the .txt file would be named : "Files that I was unable to download because of [Errno 2], please download them manually" , and the .txt is put at this path:

Cattura1

near Lora, Embeddings, Checkpoints .... Folders, to find it easily. This is my idea to keep tracked the missing files.

image

2)-SKIP The missing file, If it is unable to be downloaded, and proceed with other files, to continue the download.

If there's an alternative way and you find a more elegant solution to download the problemtics files anyway, silencing completely the [Errno 2], please ignore all the above suggestion about .txt generation with URL list and feel free to suggest. Thanks for every cooperation As I already said in the past, I really love till death this tool like all of you guys and I'm so happy to see day after day the improvements of the code through creator's hard work and various suggestions and the increasing number of features and funcionalities, getting closer and closer to become a perfect assistant batch file downloader.

Confuzu commented 1 month ago

working on a solution