opensouls / terminal-copilot

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

`sh: 1: [COMMAND]: not found` when executing command #13

Closed ewermor closed 1 year ago

ewermor commented 1 year ago

I'm running into these errors on Debian 11

copilot show history
>  history
    execute
    copy
    explain shell

execute :

sh: 1: history: not found

copy :

> history
> copied
Traceback (most recent call last):
  File "/home/[USER]/.local/bin/copilot", line 8, in <module>
    sys.exit(main())
  File "/home/[USER]/.local/lib/python3.9/site-packages/copilot/copilot.py", line 95, in main
    subprocess.run(["pbcopy"], input=cmd, encoding="utf-8")
  File "/usr/lib/python3.9/subprocess.py", line 505, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/lib/python3.9/subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.9/subprocess.py", line 1823, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'pbcopy'
github-actions[bot] commented 1 year ago

Message that will be displayed on users' first issue

JoelKronander commented 1 year ago

Copilot is not always correct, and I am guessing the history command dosent work in your shell?

Can you run 'history' separately i the shell?

Also try running copilot again and change your prompt slightly like "get the history in Debian" and see if that works.

ewermor commented 1 year ago

Yes history should work on debian.

MostHated commented 1 year ago

I am on Pop_OS (Ubuntu) and I got the " No such file or directory: 'pbcopy'" error when I attempted to select "Copy". I didn't see pbcopy as a requirement, and I don't think I have ever even heard of it before. A quick search of it looks like that might be a Mac only command? Linux typically uses xclip or xsel.

Mac Only ![](https://img.instance.id/WgTUsIEKi8tc/direct)

Either an OS check to use the appropriate command per system, or something like this should quickly handle that:

https://pypi.org/project/pyperclip/

MostHated commented 1 year ago

I put together a pull request for this change here: https://github.com/Methexis-Inc/terminal-copilot/pull/19

JoelKronander commented 1 year ago

Awesome!