developer icon indicating copy to clipboard operation
developer copied to clipboard

Characters like `+` throws parsing error

Open onlyphantom opened this issue 1 year ago • 2 comments

Running python main_no_modal.py with prompt including characters like ; and : would throw the following error, seems to be related to one of the parsing (.lstrip(" \t")).

Edit: After some experimentation, it seems like it is the character + instead.

Traceback (most recent call last):
  File "~/Desktop/developer/main_no_modal.py", line 230, in <module>
    main(prompt, directory, file)
  File "~/Desktop/developer/main_no_modal.py", line 135, in main
    list_actual = ast.literal_eval(filepaths_string)
  File "/usr/lib/python3.10/ast.py", line 62, 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 "<unknown>", line 1
    - /src/index.js
      ^
SyntaxError: invalid syntax

Just for reproducibility:

  1. install the dependencies
  2. export the OpenAI API Key
  3. runpython main_no_modal.py "a react app that is luxurious and dark-themed, offering a simple form to RSVP to the wedding; Form has following fields: first name, last name, checkbox indicating a +1" -> this will not work and will throw the earlier error
  4. run python main_no_modal.py "a react app that is luxurious and dark-themed, offering a simple form to RSVP to the wedding." -> this will work.

onlyphantom avatar Jun 05 '23 09:06 onlyphantom