open-interpreter icon indicating copy to clipboard operation
open-interpreter copied to clipboard

Fix: NameError: name 'computer' is not defined

Open MikeBirdTech opened this issue 1 year ago • 2 comments

Describe the changes you have made:

The run method in the Terminal class is a generator function that executes some code and yields the results one at a time. In a previous commit, the for loop was removed that was used to iterate over these results, which caused the run method to not actually be executed because its results were not being consumed. This commit adds the for loop back to ensure that the run method is properly executed.

Reference any relevant issues (e.g. "Fixes #000"):

https://github.com/KillianLucas/open-interpreter/issues/875

Pre-Submission Checklist (optional but appreciated):

  • [x] I have included relevant documentation updates (stored in /docs)
  • [x] I have read docs/CONTRIBUTING.md
  • [x] I have read docs/ROADMAP.md

OS Tests (optional but appreciated):

  • [ ] Tested on Windows
  • [x] Tested on MacOS
  • [ ] Tested on Linux

MikeBirdTech avatar Jan 17 '24 17:01 MikeBirdTech

Traceback (most recent call last): File "", line 1, in File "E:\dev\open-interpreter\interpreter\core\core.py", line 46, in start_terminal_interface start_terminal_interface(self) File "E:\dev\open-interpreter\interpreter\terminal_interface\start_terminal_interface.py", line 543, in start_terminal_interface for _ in interpreter.computer.run( File "E:\dev\open-interpreter\interpreter\core\computer\terminal\terminal.py", line 40, in run for chunk in self._streaming_chat(language, code, stream=True): ^^^^^^^^^^^^^^^^^^^^ AttributeError: 'Terminal' object has no attribute '_streaming_chat'

Notnaton avatar Jan 17 '24 18:01 Notnaton

Added a quick fix, just putting stream=True

Notnaton avatar Jan 17 '24 19:01 Notnaton

Thanks @Arrendy! And thanks @Notnaton for working on this as well! This was totally a mistake I made, luckily committed after the last version that went out to pip, so just a problem for us working off the repo.

Renaming it to run is exactly how it ought to work— if stream=False, we just pull from an identical run with stream=True and return that output. Merging!

KillianLucas avatar Jan 18 '24 07:01 KillianLucas