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
16 stars 4 forks source link

1 Error and 1 Suggestion #16

Open LeonWGal opened 1 month ago

LeonWGal commented 1 month ago
Traceback (most recent call last):
  File "S:\webui_forge_cu121\webui\models\Lora\civitAI_Model_downloader.py", line 385, in <module>
    process_username(username, download_type)
  File "S:\webui_forge_cu121\webui\models\Lora\civitAI_Model_downloader.py", line 286, in process_username
    fetch_user_data = fetch_all_models(token, username)
  File "S:\webui_forge_cu121\webui\models\Lora\fetch_all_models.py", line 98, in fetch_all_models
    file.write(f"{category} - Item: {item_name}\n")
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\encodings\cp1251.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position 19-20: character maps to <undefined>
Traceback (most recent call last):
  File "S:\webui_forge_cu121\webui\models\Lora\civitAI_Model_downloader.py", line 385, in <module>
    process_username(username, download_type)
  File "S:\webui_forge_cu121\webui\models\Lora\civitAI_Model_downloader.py", line 286, in process_username
    fetch_user_data = fetch_all_models(token, username)
  File "S:\webui_forge_cu121\webui\models\Lora\fetch_all_models.py", line 98, in fetch_all_models
    file.write(f"{category} - Item: {item_name}\n")
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\encodings\cp1251.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u014d' in position 21: character maps to <undefined>
Traceback (most recent call last):
  File "S:\webui_forge_cu121\webui\models\Lora\civitAI_Model_downloader.py", line 385, in <module>
    process_username(username, download_type)
  File "S:\webui_forge_cu121\webui\models\Lora\civitAI_Model_downloader.py", line 286, in process_username
    fetch_user_data = fetch_all_models(token, username)
  File "S:\webui_forge_cu121\webui\models\Lora\fetch_all_models.py", line 98, in fetch_all_models
    file.write(f"{category} - Item: {item_name}\n")
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\encodings\cp1251.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position 22-23: character maps to <undefined>

Some authors (for example, pmdp, konan, dinixdream) are not loaded with this error. I also want to suggest that locon be loaded together with lora. It is inconvenient for me that I need to run the program separately to download locon

sb976229 commented 1 month ago

I fixed this by editing line 98 in fetch_all_models.py this should fix it: with open(file_path, "w", encoding='utf-8') as file:

LeonWGal commented 1 month ago

Thanks, I'll try

Confuzu commented 1 month ago

thanks @sb976229 I must have forgotten an utf8 encoding.

updated the code of fetch_all_models

@LeonWGal
As for your suggestion, thanks but I will leave the layout as it is. I want to keep the locons separate from the LORAs for a better overview.

LeonWGal commented 1 month ago

@LeonWGal As for your suggestion, thanks but I will leave the layout as it is. I want to keep the locons separate from the LORAs for a better overview.

In such a case, I would suggest to make it possible for people to choose several types of models at once (as in the case of authors) or some presets (lora+locon)