TheR1D / shell_gpt

A command-line productivity tool powered by AI large language models like GPT-4, will help you accomplish your tasks faster and more efficiently.
MIT License
8.84k stars 696 forks source link

An issue with Python version < 3.8 (walrus operator) #459

Open apprithm opened 5 months ago

apprithm commented 5 months ago

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="")) != '"""':
                      ^
TheR1D commented 5 months ago

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.