[GH-ISSUE #202] UnicodeEncodeError at startup in tag_autocomplete_helper.py in model_keyword_support.py #144

Closed
opened 2026-10-30 21:20:01 +00:00 by bsakaguchi · 2 comments
Owner

Originally created by @halr9000 on GitHub (Jul 22, 2023).
Original GitHub issue: https://github.com/DominikDoom/a1111-sd-webui-tagcomplete/issues/202

Been using tagcomplete fine for a long time (nice job!). Installed the model-keyword extension and after restart, I see this:

*** Error loading script: tag_autocomplete_helper.py
    Traceback (most recent call last):
      File "D:\hal\stable-diffusion\ux\modules\scripts.py", line 274, in load_scripts
        script_module = script_loading.load_module(scriptfile.path)
      File "D:\hal\stable-diffusion\ux\modules\script_loading.py", line 10, in load_module
        module_spec.loader.exec_module(module)
      File "<frozen importlib._bootstrap_external>", line 883, in exec_module
      File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
      File "D:\hal\stable-diffusion\ux\extensions\a1111-sd-webui-tagcomplete\scripts\tag_autocomplete_helper.py", line 284, in <module>
        write_temp_files()
      File "D:\hal\stable-diffusion\ux\extensions\a1111-sd-webui-tagcomplete\scripts\tag_autocomplete_helper.py", line 281, in write_temp_files
        update_hash_cache()
      File "D:\hal\stable-diffusion\ux\extensions\a1111-sd-webui-tagcomplete\scripts\model_keyword_support.py", line 29, in update_hash_cache
        file.write(f"{name},{hash},{mtime}\n")
      File "C:\Users\hal\AppData\Local\Programs\Python\Python310\lib\encodings\cp1252.py", line 19, in encode
        return codecs.charmap_encode(input,self.errors,encoding_table)[0]
    UnicodeEncodeError: 'charmap' codec can't encode characters in position 23-24: character maps to <undefined>

I have a few loras with kanji characters in the filename, perhaps that's the root cause, but I don't really know. Any clues? Running latest versions of everything involved.

Originally created by @halr9000 on GitHub (Jul 22, 2023). Original GitHub issue: https://github.com/DominikDoom/a1111-sd-webui-tagcomplete/issues/202 Been using tagcomplete fine for a long time (nice job!). Installed the [model-keyword extension](https://github.com/mix1009/model-keyword) and after restart, I see this: ``` *** Error loading script: tag_autocomplete_helper.py Traceback (most recent call last): File "D:\hal\stable-diffusion\ux\modules\scripts.py", line 274, in load_scripts script_module = script_loading.load_module(scriptfile.path) File "D:\hal\stable-diffusion\ux\modules\script_loading.py", line 10, in load_module module_spec.loader.exec_module(module) File "<frozen importlib._bootstrap_external>", line 883, in exec_module File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed File "D:\hal\stable-diffusion\ux\extensions\a1111-sd-webui-tagcomplete\scripts\tag_autocomplete_helper.py", line 284, in <module> write_temp_files() File "D:\hal\stable-diffusion\ux\extensions\a1111-sd-webui-tagcomplete\scripts\tag_autocomplete_helper.py", line 281, in write_temp_files update_hash_cache() File "D:\hal\stable-diffusion\ux\extensions\a1111-sd-webui-tagcomplete\scripts\model_keyword_support.py", line 29, in update_hash_cache file.write(f"{name},{hash},{mtime}\n") File "C:\Users\hal\AppData\Local\Programs\Python\Python310\lib\encodings\cp1252.py", line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_table)[0] UnicodeEncodeError: 'charmap' codec can't encode characters in position 23-24: character maps to <undefined> ``` I have a few loras with kanji characters in the filename, perhaps that's the root cause, but I don't really know. Any clues? Running latest versions of everything involved.
Author
Owner

@DominikDoom commented on GitHub (Jul 22, 2023):

Yeah, small oversight on my part, that write function was still missing the UTF-8 encoding setting. Should be fixed now.

<!-- gh-comment-id:1646622409 --> @DominikDoom commented on GitHub (Jul 22, 2023): Yeah, small oversight on my part, that write function was still missing the UTF-8 encoding setting. Should be fixed now.
Author
Owner

@halr9000 commented on GitHub (Jul 22, 2023):

Dang. That was quick. :D 👋

<!-- gh-comment-id:1646622513 --> @halr9000 commented on GitHub (Jul 22, 2023): Dang. That was quick. :D 👋
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
DominikDoom/a1111-sd-webui-tagcomplete#144
No description provided.