OpenInterpreter / open-interpreter

A natural language interface for computers
http://openinterpreter.com/
GNU Affero General Public License v3.0
55.24k stars 4.81k forks source link

AttributeError: 'list' object has no attribute 'lower' when starting interpreter from master branch #1120

Open tiry opened 7 months ago

tiry commented 7 months ago

Describe the bug

Trying to run the interpreter from the source code / main branch (the wheel version works ok)

 > interpreter
Traceback (most recent call last):
  File "/Users/tiry/Library/Caches/pypoetry/virtualenvs/open-interpreter-qdM9pZ2G-py3.11/bin/interpreter", line 3, in <module>
    from interpreter.terminal_interface.start_terminal_interface import main
  File "/Users/tiry/dev/open-interpreter/interpreter/__init__.py", line 4, in <module>
    interpreter = OpenInterpreter()
                  ^^^^^^^^^^^^^^^^^
  File "/Users/tiry/dev/open-interpreter/interpreter/core/core.py", line 129, in __init__
    self.computer.skills.import_skills()
  File "/Users/tiry/dev/open-interpreter/interpreter/core/computer/skills/skills.py", line 51, in import_skills
    if "traceback" in output.lower():
                      ^^^^^^^^^^^^
AttributeError: 'list' object has no attribute 'lower'
 ~/dev/open-interpreter │ on main !1 ?1  [IPKernelApp] WARNING | Parent appears to have exited, shutting down.                            1 х │ 3.11.8 Py

Basically, it seems that the output is a dictionary

output = self.computer.run("python", code_to_run)

whereas the code expected a string

    if "traceback" in output.lower():

In my case, output = [{'type': 'console', 'format': 'output', 'content': ''}]

Reproduce

  1. Clone the repository
  2. pyenv shell 3.11.8
  3. poetry install
  4. source $(poetry env info --path)/bin/activate
  5. python -m interpreter

Expected behavior

Display the interpreter prompt without errir

Screenshots

No response

Open Interpreter version

main branch

Python version

3.11.8

Operating System name and version

MacOS 14.4

Additional context

No response

SgtPooki commented 7 months ago

Yep, getting this error too. quick hack: output = output[0]["content"] after output = self.computer.run("python", code_to_run)

https://github.com/OpenInterpreter/open-interpreter/commit/e5fdc57726869e2149e6cef36b287a957a58d507 seems to be at fault

from main:

git bisect start
git bisect bad
git checkout 68ab324 # parent of e5fdc57
poetry install
poetry run interpreter
# given welcome message, prompted for open ai key...
[nix-shell:~/code/work/foss/SgtPooki/open-interpreter]$ git bisect good
# continue through git bisect, checking if `poetry run interpreter` works..
e5fdc57726869e2149e6cef36b287a957a58d507 is the first bad commit
commit e5fdc57726869e2149e6cef36b287a957a58d507
Author: killian <63927363+KillianLucas@users.noreply.github.com>
Date:   Thu Mar 21 12:18:11 2024 -0700

    Fixed rare skill issue

 interpreter/core/computer/skills/skills.py | 32 +++++++++++++++++++++++++++++-
 1 file changed, 31 insertions(+), 1 deletion(-)
SgtPooki commented 7 months ago

https://github.com/OpenInterpreter/open-interpreter/commit/e5fdc57726869e2149e6cef36b287a957a58d507#r140139185 mentions this as well, and https://github.com/OpenInterpreter/open-interpreter/pull/1114 may fix it

MikeBirdTech commented 7 months ago

Hey @tiry Are you able to try the fix that @SgtPooki mentioned to see if it resolves the issue?

tiry commented 7 months ago

Hey @MikeBirdTech, I was able to fix the code and make it run on my side, but I figured I should report so it gets fixed properly in the main branch since it looks to me like a miss alignment between 2 parts of the code.

And yes, the fix proposed by @SgtPooki is very similar to what I did to be able to run the code, so it should fix the issue.