Skip to content

Commit 7ae79b3

Browse files
committed
write log files in utf-8, not ascii
1 parent 9a8cd96 commit 7ae79b3

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

ldm/dream/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def do_POST(self):
8383
post_data['initimg'] = '' # Don't send init image back
8484

8585
# Append post_data to log
86-
with open("./outputs/img-samples/dream_web_log.txt", "a") as log:
86+
with open("./outputs/img-samples/dream_web_log.txt", "a", encoding="utf-8") as log:
8787
for output in outputs:
8888
log.write(f"{output[0]}: {json.dumps(post_data)}\n")
8989

scripts/dream.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def main():
6969
if opt.infile:
7070
try:
7171
if os.path.isfile(opt.infile):
72-
infile = open(opt.infile, 'r')
72+
infile = open(opt.infile, 'r', encoding='utf-8')
7373
elif opt.infile == '-': # stdin
7474
infile = sys.stdin
7575
else:
@@ -217,7 +217,7 @@ def get_next_command(infile=None) -> str: #command string
217217
command = command.strip()
218218
print(f'#{command}')
219219
return command
220-
220+
221221
def dream_server_loop(t2i):
222222
print('\n* --web was specified, starting web server...')
223223
# Change working directory to the stable-diffusion directory
@@ -244,7 +244,7 @@ def write_log_message(prompt, results, log_path):
244244
log_lines = [f'{r[0]}: {prompt} -S{r[1]}\n' for r in results]
245245
print(*log_lines, sep='')
246246

247-
with open(log_path, 'a') as file:
247+
with open(log_path, 'a', encoding='utf-8') as file:
248248
file.writelines(log_lines)
249249

250250

0 commit comments

Comments
 (0)