mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Merge pull request #175 from bakkot/unicode
read/write plain text files in utf-8, not ascii
This commit is contained in:
commit
fd13526454
@ -90,7 +90,7 @@ class DreamServer(BaseHTTPRequestHandler):
|
|||||||
post_data['initimg'] = '' # Don't send init image back
|
post_data['initimg'] = '' # Don't send init image back
|
||||||
|
|
||||||
# Append post_data to log
|
# Append post_data to log
|
||||||
with open("./outputs/img-samples/dream_web_log.txt", "a") as log:
|
with open("./outputs/img-samples/dream_web_log.txt", "a", encoding="utf-8") as log:
|
||||||
for output in outputs:
|
for output in outputs:
|
||||||
log.write(f"{output[0]}: {json.dumps(post_data)}\n")
|
log.write(f"{output[0]}: {json.dumps(post_data)}\n")
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ def main():
|
|||||||
if opt.infile:
|
if opt.infile:
|
||||||
try:
|
try:
|
||||||
if os.path.isfile(opt.infile):
|
if os.path.isfile(opt.infile):
|
||||||
infile = open(opt.infile, 'r')
|
infile = open(opt.infile, 'r', encoding='utf-8')
|
||||||
elif opt.infile == '-': # stdin
|
elif opt.infile == '-': # stdin
|
||||||
infile = sys.stdin
|
infile = sys.stdin
|
||||||
else:
|
else:
|
||||||
@ -244,7 +244,7 @@ def write_log_message(prompt, results, log_path):
|
|||||||
log_lines = [f'{r[0]}: {prompt} -S{r[1]}\n' for r in results]
|
log_lines = [f'{r[0]}: {prompt} -S{r[1]}\n' for r in results]
|
||||||
print(*log_lines, sep='')
|
print(*log_lines, sep='')
|
||||||
|
|
||||||
with open(log_path, 'a') as file:
|
with open(log_path, 'a', encoding='utf-8') as file:
|
||||||
file.writelines(log_lines)
|
file.writelines(log_lines)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user