AUTOMATIC1111 / stable-diffusion-webui-wildcards

Wildcards
421 stars 103 forks source link

Suddently stopped working, it keeps printing an utf-8 error #38

Open Redenrik opened 4 months ago

Redenrik commented 4 months ago

Till yesterday everything worked fine, but today, using the same wildcards and prompts it doesn't works and prints this in the terminal each time i start a generation that includes wildcards in it's prompt:

*** Error running process: D:\Red-AI\stable-diffusion-webui\extensions\stable-diffusion-webui-wildcards\scripts\wildcards.py
    Traceback (most recent call last):
      File "D:\Red-AI\stable-diffusion-webui\modules\scripts.py", line 718, in process
        script.process(p, *script_args)
      File "D:\Red-AI\stable-diffusion-webui\extensions\stable-diffusion-webui-wildcards\scripts\wildcards.py", line 49, in process
        p.all_prompts = self.replace_prompts(p.all_prompts, p.all_seeds)
      File "D:\Red-AI\stable-diffusion-webui\extensions\stable-diffusion-webui-wildcards\scripts\wildcards.py", line 42, in replace_prompts
        res.append("".join(self.replace_wildcard(chunk, gen) for chunk in text.split("__")))
      File "D:\Red-AI\stable-diffusion-webui\extensions\stable-diffusion-webui-wildcards\scripts\wildcards.py", line 42, in <genexpr>
        res.append("".join(self.replace_wildcard(chunk, gen) for chunk in text.split("__")))
      File "D:\Red-AI\stable-diffusion-webui\extensions\stable-diffusion-webui-wildcards\scripts\wildcards.py", line 27, in replace_wildcard
        return gen.choice(f.read().splitlines())
      File "C:\Users\enric\AppData\Local\Programs\Python\Python310\lib\codecs.py", line 322, in decode
        (result, consumed) = self._buffer_decode(data, self.errors, final)
    UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe3 in position 7: invalid continuation byte
deprobot commented 5 days ago

EDIT: This is actually resolved. The .txt files need to be saved with UTF-8 encoding. I generated the text files from filenames in a folder through command prompt and it saved them with ANSI encoding by default.

Got this error now as well. Updating extensions and deleting/regenerating venv folder did not help.