fix crash that occurs in write_log when user interrupts generation with ^C

This commit is contained in:
Lincoln Stein 2022-09-28 11:57:59 -04:00
parent 743342816b
commit 98271a0267
2 changed files with 6 additions and 2 deletions

View File

@ -81,7 +81,7 @@ with metadata_from_png():
"""
import argparse
from argparse import Namespace
from argparse import Namespace, RawTextHelpFormatter
import shlex
import json
import hashlib
@ -463,7 +463,9 @@ class Args(object):
# This creates the parser that processes commands on the dream> command line
def _create_dream_cmd_parser(self):
parser = argparse.ArgumentParser(
description="""
formatter_class=RawTextHelpFormatter,
description=
"""
*Image generation:*
To generate images, type a text prompt with optional switches. Example:
a fantastic alien landscape -W576 -H512 -s60 -n4

View File

@ -22,6 +22,8 @@ def write_log(results, log_path, file_types, output_cntr):
def write_log_message(results, output_cntr):
"""logs to the terminal"""
if len(results) == 0:
return output_cntr
log_lines = [f"{path}: {prompt}\n" for path, prompt in results]
if len(log_lines)>1:
subcntr = 1