This commit is contained in:
lllyasviel 2023-10-16 23:57:58 -07:00
parent 32ff981075
commit ef4e120d0a
2 changed files with 5 additions and 5 deletions

View File

@ -1 +1 @@
version = '2.1.688'
version = '2.1.689'

View File

@ -121,9 +121,9 @@ def apply_wildcards(wildcard_text, seed=None, directory=wildcards_path):
placeholders = re.findall(r'__(\w+)__', wildcard_text)
for placeholder in placeholders:
try:
with open(os.path.join(directory, f'{placeholder}.txt')) as f:
with open(os.path.join(directory, f'{placeholder}.txt'), encoding='utf-8') as f:
words = f.read().splitlines()
f.close()
rng = random.Random(seed)
wildcard_text = re.sub(rf'__{placeholder}__', rng.choice(words), wildcard_text)
except IOError: