shell_gpt icon indicating copy to clipboard operation
shell_gpt copied to clipboard

An issue with Python version < 3.8 (walrus operator)

Open apprithm opened this issue 2 years ago • 1 comments

It output the following error when I enter: sgpt "nginx default config file location"

Traceback (most recent call last):
  File "/Users/guest/miniconda3/bin/sgpt", line 5, in <module>
    from sgpt import cli
  File "/Users/guest/miniconda3/lib/python3.7/site-packages/sgpt/__init__.py", line 1, in <module>
    from .app import main as main
  File "/Users/guest/miniconda3/lib/python3.7/site-packages/sgpt/app.py", line 12, in <module>
    from sgpt.handlers.repl_handler import ReplHandler
  File "/Users/guest/miniconda3/lib/python3.7/site-packages/sgpt/handlers/repl_handler.py", line 20
    while (user_input := typer.prompt("...", prompt_suffix="")) != '"""':
                      ^

apprithm avatar Jan 29 '24 08:01 apprithm

Thank you for reporting this issue. The walrus operator := was added in Python 3.8, since you have Python 3.7, it can't handle it. ShellGPT is supposed to support any Python version starting from 3.6, as defined in pyproject.toml. We will address this in the upcoming release. In the meantime, you can resolve the issue by upgrading your Python to version 3.8 or higher.

TheR1D avatar Jan 29 '24 21:01 TheR1D