opensouls / terminal-copilot

A smart terminal assistant that helps you find the right command.
Apache License 2.0
572 stars 43 forks source link

Unterminated triple-quoted string literal #48

Closed Deftera186 closed 1 year ago

Deftera186 commented 1 year ago

Steps to reproduce:

  1. Clone the repository using git clone https://github.com/opensouls/terminal-copilot.git
  2. cd terminal-copilot
  3. python3 -m venv .venv is used to create a new environment.
  4. Activate the environment using source .venv/bin/activate.
  5. Install the requirements using pip install -r requirements.txt.
  6. python3 setup.py install
  7. face an error when running copilot:
    Traceback (most recent call last):
    File "/home/deftera/terminal-copilot/.venv/bin/copilot", line 33, in <module>
    sys.exit(load_entry_point('terminal-copilot==1.2.2', 'console_scripts', 'copilot')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/deftera/terminal-copilot/.venv/bin/copilot", line 25, in importlib_load_entry_point
    return next(matches).load()
           ^^^^^^^^^^^^^^^^^^^^
    File "/usr/lib/python3.11/importlib/metadata/__init__.py", line 202, in load
    module = import_module(match.group('module'))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
    File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
    File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
    File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
    File "<frozen importlib._bootstrap_external>", line 936, in exec_module
    File "<frozen importlib._bootstrap_external>", line 1074, in get_code
    File "<frozen importlib._bootstrap_external>", line 1004, in source_to_code
    File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
    File "/home/deftera/terminal-copilot/.venv/lib/python3.11/site-packages/terminal_copilot-1.2.2-py3.11.egg/copilot/main.py", line 246
    """
    ^
    SyntaxError: unterminated triple-quoted string literal (detected at line 252)

Details about my environment:

A possible fix for the Issue (which needs discussion):

The problem seems to be when we are adding prompt += """. Which can be proven, by removing the line, and fixing the problem. The thing is, I don't know what was actually intended (it could be adding a quote, which can be solved by escaping it, or surround it using single quotes if what was intended was to add triple quotes).

https://github.com/opensouls/terminal-copilot/blob/2bca75d526a4ed2712a803a479241c77db7e5d9a/copilot/main.py#LL83C1-L89C47

github-actions[bot] commented 1 year ago

Hey! Thanks for sharing feedback with the community!

benripka commented 1 year ago

Same issue for me...

JoelKronander commented 1 year ago

fixed