my-sd/modules
Neil Mahseth c258dd34a8
Fix UnicodeEncodeError when writing to file CLIP Interrogator Batch Mode
The code snippet print(interrogation_function(img), file=open(os.path.join(ii_output_dir, f"{left}.txt"), 'a')) raises a UnicodeEncodeError with the message "'charmap' codec can't encode character '\u016b' in position 129". This error occurs because the default encoding used by the open() function cannot handle certain Unicode characters.

To fix this issue, the encoding parameter needs to be explicitly specified when opening the file. By using an appropriate encoding, such as 'utf-8', we can ensure that Unicode characters are properly encoded and written to the file.

The updated code should be modified as follows:

python
Copy code
print(interrogation_function(img), file=open(os.path.join(ii_output_dir, f"{left}.txt"), 'a', encoding='utf-8'))
By making this change, the code will no longer raise the UnicodeEncodeError and will correctly handle Unicode characters during the file write operation.
2023-07-06 22:02:47 +05:30
..
api Merge pull request #10956 from akx/len 2023-06-05 11:06:37 +03:00
codeformer Autofix Ruff W (not W605) (mostly whitespace) 2023-05-11 20:29:11 +03:00
hypernetworks rename print_error to report, use it with together with package name 2023-05-31 19:56:37 +03:00
models/diffusion Simplify a bunch of len(x) > 0/len(x) == 0 style expressions 2023-06-02 15:07:10 +03:00
textual_inversion Use os.makedirs(..., exist_ok=True) 2023-06-13 12:35:43 +03:00
call_queue.py Simplify a bunch of len(x) > 0/len(x) == 0 style expressions 2023-06-02 15:07:10 +03:00
cmd_args.py revert default cross attention optimization to Doggettx 2023-06-01 08:12:21 +03:00
codeformer_model.py Use os.makedirs(..., exist_ok=True) 2023-06-13 12:35:43 +03:00
config_states.py rename print_error to report, use it with together with package name 2023-05-31 19:56:37 +03:00
deepbooru_model.py Add option for float32 sampling with float16 UNet 2023-01-25 01:13:02 -05:00
deepbooru.py ruff auto fixes 2023-05-10 11:05:02 +03:00
devices.py run basic torch calculation at startup in parallel to reduce the performance impact of first generation 2023-05-21 21:55:14 +03:00
errors.py Added sysinfo tab to settings 2023-06-03 13:55:35 +03:00
esrgan_model_arch.py Autofix Ruff W (not W605) (mostly whitespace) 2023-05-11 20:29:11 +03:00
esrgan_model.py change upscalers to download models into user-specified directory (from commandline args) rather than the default models/<...> 2023-05-19 09:09:18 +03:00
extensions.py Use os.makedirs(..., exist_ok=True) 2023-06-13 12:35:43 +03:00
extra_networks_hypernet.py Simplify a bunch of len(x) > 0/len(x) == 0 style expressions 2023-06-02 15:07:10 +03:00
extra_networks.py remove redone compare 2023-06-04 05:19:47 +09:00
extras.py use a local variable instead of dictionary entry for sd_merge_models in merge model metadata code 2023-05-17 17:44:07 +03:00
face_restoration.py codeformer support 2022-09-07 12:32:28 +03:00
generation_parameters_copypaste.py add missing infotext entry for the pad cond/uncond option 2023-06-27 06:18:43 +03:00
gfpgan_model.py Use os.makedirs(..., exist_ok=True) 2023-06-13 12:35:43 +03:00
gitpython_hack.py Patch GitPython to not use leaky persistent processes 2023-05-29 08:31:11 +03:00
hashes.py calculate hashes for Lora 2023-05-19 22:59:29 +03:00
images.py Simplify a bunch of len(x) > 0/len(x) == 0 style expressions 2023-06-02 15:07:10 +03:00
img2img.py revert the message to how it was 2023-06-05 11:08:57 +03:00
import_hook.py add a comment for disable xformers hack 2022-12-24 07:57:56 +03:00
interrogate.py rename print_error to report, use it with together with package name 2023-05-31 19:56:37 +03:00
launch_utils.py SD_WEBUI_RESTARTING 2023-06-06 02:52:05 +09:00
localization.py rename print_error to report, use it with together with package name 2023-05-31 19:56:37 +03:00
lowvram.py fix for conds of second hires fox pass being calculated using first pass's networks, and add an option to revert to old behavior 2023-06-04 13:07:31 +03:00
mac_specific.py Autofix Ruff W (not W605) (mostly whitespace) 2023-05-11 20:29:11 +03:00
masking.py Autofix Ruff W (not W605) (mostly whitespace) 2023-05-11 20:29:11 +03:00
memmon.py attempt to fix memory monitor with multiple CUDA devices 2023-03-12 21:04:17 +03:00
modelloader.py Use os.makedirs(..., exist_ok=True) 2023-06-13 12:35:43 +03:00
ngrok.py Merge branch 'dev' into ngrok-py 2023-05-18 10:12:17 +03:00
paths_internal.py fix --data-dir for COMMANDLINE_ARGS 2023-05-12 22:33:21 +09:00
paths.py Vendor in the single module used from taming_transformers; remove taming_transformers dependency 2023-05-30 12:47:57 +03:00
postprocessing.py Merge branch 'dev' into master 2023-04-29 17:02:14 +03:00
processing.py linter 2023-06-09 22:47:27 +03:00
progress.py move some settings to the new Optimization page 2023-05-17 20:22:54 +03:00
prompt_parser.py Simplify a bunch of len(x) > 0/len(x) == 0 style expressions 2023-06-02 15:07:10 +03:00
realesrgan_model.py rename print_error to report, use it with together with package name 2023-05-31 19:56:37 +03:00
restart.py Restart: only do restart if running via the wrapper script 2023-06-05 20:04:28 +03:00
Roboto-Regular.ttf Drop fonts + font-roboto deps since we only use the single regular cut of Roboto 2023-05-11 10:07:28 +03:00
safe.py rename print_error to report, use it with together with package name 2023-05-31 19:56:37 +03:00
script_callbacks.py Simplify a bunch of len(x) > 0/len(x) == 0 style expressions 2023-06-02 15:07:10 +03:00
script_loading.py rename print_error to report, use it with together with package name 2023-05-31 19:56:37 +03:00
scripts_auto_postprocessing.py ruff auto fixes 2023-05-10 11:05:02 +03:00
scripts_postprocessing.py suggestions and fixes from the PR 2023-05-10 21:21:32 +03:00
scripts.py Merge branch 'dev' into startup-profile 2023-06-01 08:42:50 +03:00
sd_disable_initialization.py autofixes from ruff 2023-05-10 07:52:45 +03:00
sd_hijack_checkpoint.py add option to show/hide warnings 2023-01-18 23:04:24 +03:00
sd_hijack_clip_old.py Simplify a bunch of len(x) > 0/len(x) == 0 style expressions 2023-06-02 15:07:10 +03:00
sd_hijack_clip.py Simplify a bunch of len(x) > 0/len(x) == 0 style expressions 2023-06-02 15:07:10 +03:00
sd_hijack_inpainting.py manual fixes for some C408 2023-05-10 11:55:09 +03:00
sd_hijack_ip2p.py imports cleanup for ruff 2023-05-10 08:43:42 +03:00
sd_hijack_open_clip.py Add support Stable Diffusion 2.0 2022-11-26 16:10:46 +03:00
sd_hijack_optimizations.py Merge pull request #11066 from aljungberg/patch-1 2023-06-07 07:48:52 +03:00
sd_hijack_unet.py Fix up string formatting/concatenation to f-strings where feasible 2023-05-09 22:25:39 +03:00
sd_hijack_utils.py Fix full previews, --no-half-vae 2023-01-26 01:43:35 -05:00
sd_hijack_xlmr.py imports cleanup for ruff 2023-05-10 08:43:42 +03:00
sd_hijack.py revert default cross attention optimization to Doggettx 2023-06-01 08:12:21 +03:00
sd_models_config.py imports cleanup for ruff 2023-05-10 08:43:42 +03:00
sd_models.py Use os.makedirs(..., exist_ok=True) 2023-06-13 12:35:43 +03:00
sd_samplers_common.py simplify single_sample_to_image 2023-05-17 14:53:39 +03:00
sd_samplers_compvis.py suppress ENSD infotext for samplers that don't use it 2023-05-16 11:54:02 +03:00
sd_samplers_kdiffusion.py add missing infotext entry for the pad cond/uncond option 2023-06-27 06:18:43 +03:00
sd_samplers.py suppress ENSD infotext for samplers that don't use it 2023-05-16 11:54:02 +03:00
sd_unet.py custom unet support 2023-05-27 15:47:33 +03:00
sd_vae_approx.py modules/sd_vae_approx.py: fix VAE-approx path 2023-03-11 20:00:12 +08:00
sd_vae_taesd.py TAESD fix 2023-05-17 17:39:07 +08:00
sd_vae.py Merge branch 'dev' into find_vae 2023-05-14 11:46:27 +03:00
shared_items.py add an option to show selected setting in main txt2img/img2img UI 2023-05-31 22:40:09 +03:00
shared.py Merge pull request #11136 from arch-fan/typo 2023-06-27 06:40:43 +03:00
styles.py infer styles from prompts, and an option to control the behavior 2023-06-04 10:56:48 +03:00
sub_quadratic_attention.py Autofix Ruff W (not W605) (mostly whitespace) 2023-05-11 20:29:11 +03:00
sysinfo.py add whitelist for environment in the report 2023-06-04 11:16:00 +03:00
timer.py work on startup profile display 2023-05-21 00:41:41 +03:00
txt2img.py Use settings instead of main interface 2023-05-23 10:58:57 +08:00
ui_common.py add an option to show selected setting in main txt2img/img2img UI 2023-05-31 22:40:09 +03:00
ui_components.py Allow user input for gradio theme selection 2023-04-29 12:52:09 +03:00
ui_extensions.py Merge pull request #11408 from wfjsw/patch-1 2023-06-27 06:20:59 +03:00
ui_extra_networks_checkpoints.py Apply suggestions from code review 2023-06-02 16:12:24 -04:00
ui_extra_networks_hypernets.py Apply suggestions from code review 2023-06-02 16:12:24 -04:00
ui_extra_networks_textual_inversion.py Apply suggestions from code review 2023-06-02 16:12:24 -04:00
ui_extra_networks.py Apply suggestions from code review 2023-06-02 16:12:24 -04:00
ui_gradio_extensions.py add an option to show selected setting in main txt2img/img2img UI 2023-05-31 22:40:09 +03:00
ui_loadsave.py allow hiding buttons in ui-config.json 2023-05-19 19:04:20 +03:00
ui_postprocessing.py imports cleanup for ruff 2023-05-10 08:43:42 +03:00
ui_settings.py Merge pull request #10956 from akx/len 2023-06-05 11:06:37 +03:00
ui_tempdir.py Update ui_tempdir.py 2023-06-04 14:20:23 +08:00
ui.py Fix UnicodeEncodeError when writing to file CLIP Interrogator Batch Mode 2023-07-06 22:02:47 +05:30
upscaler.py Fix missing ext_filter kwarg 2023-06-03 22:28:00 +07:00
xlmr.py Autofix Ruff W (not W605) (mostly whitespace) 2023-05-11 20:29:11 +03:00