unterminated string literal
DanielShemesh opened this issue · comments
in write_fantasy_novel
chapter_titles = ast.literal_eval(storyline)
Certainly, here's a more polished and expanded version of the storyline for "$$$," presented in the same list of dictionaries format as requested:
^
SyntaxError: unterminated string literal (detected at line 1)
Also getting this error:
`
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/IPython/core/interactiveshell.py", line 3553, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 5, in <cell line: 5>
novel, title, chapters, chapter_titles = write_fantasy_novel(prompt, num_chapters, writing_style, claude_true)
File "", line 266, in write_fantasy_novel
chapter_titles = ast.literal_eval(storyline)
File "/usr/lib/python3.10/ast.py", line 64, in literal_eval
node_or_string = parse(node_or_string.lstrip(" \t"), mode='eval')
File "/usr/lib/python3.10/ast.py", line 50, in parse
return compile(source, filename, mode, flags,
File "", line 21
This redesigned odyssey transports the reader through a gauntlet of growing suspense, emotional crescendos, heart-stopping showdowns, and the characters' relentless battle against the forces of darkness.
^
SyntaxError: unterminated string literal (detected at line 21)`
Seems to work if you sanitize the storyline 1st:
storyline = generate_storyline(improved_plot, num_chapters) print('storyline generated') storyline = storyline.replace("'", "\\'") print('storyline sanitized) chapter_titles = ast.literal_eval(storyline)