OpenInterpreter / 01

The open-source language model computer
http://openinterpreter.com/01
GNU Affero General Public License v3.0
4.76k stars 470 forks source link

Ctrl+C not working in Windows #231

Closed Atsui75 closed 2 months ago

Atsui75 commented 2 months ago

Describe the bug I have been trying to make Open Interpreter 01 run in my windows machine. I'd like to share my small findings so far, in case they can be of any help. I apologize beforehand for my inexperience in broadcasting my findings, I am not very familiar with github, but I really want this project to be as good as it can.

Afer initializing 01 in windows the command Ctrl+C does not work.

I think I have discovered the reason: In software/source/clients/base_device.py, line 256, the keys checked to stop program execution are keyboard.Key.ctrl and keyboard.KeyCode.from_char("c").

In my machine the key registered when pressing the left control corresponds to: keyboard.Key.ctrl_l (I also had to test if ctrl_l and c are in pressed keys separatedly: if ctrl_l in pressed keys and c in pressed keys: ...)

If I change this, Ctrl+C starts working, but the program gives a new error, which I think is due to windows not having the same process-killing method as linux or Mac:

Unhandled exception in listener callback Traceback (most recent call last): File "C:\Users\santi\AppData\Local\pypoetry\Cache\virtualenvs\01os-NWxsdfXh-py3.11\Lib\site-packages\pynput_util__init.py", line 228, in inner return f(self, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\santi\AppData\Local\pypoetry\Cache\virtualenvs\01os-NWxsdfXh-py3.11\Lib\site-packages\pynput\keyboard_win32.py", line 287, in _process self.on_press(key) File "C:\Users\santi\AppData\Local\pypoetry\Cache\virtualenvs\01os-NWxsdfXh-py3.11\Lib\site-packages\pynput_util\init__.py", line 144, in inner if f(*args) is False: ^^^^^^^^ File "C:\Users\santi\Desktop\Proxectos\01\software\source\clients\base_device.py", line 267, in on_press kill_process_tree() File "C:\Users\santi\Desktop\Proxectos\01\software\source\server\utils\process_utils.py", line 10, in kill_process_tree os.killpg(os.getpgid(pid), signal.SIGKILL) ^^^^^^^^^ AttributeError: module 'os' has no attribute 'killpg'

Thank you for this amazing project. I will try to keep researching in order to make this tool work in my computer.

If I am doing something wrong or if somebody has already solved this issues in windows I'd love any help or suggestion.

Thank you in advance :)

Desktop (please complete the following information):

Atsui75 commented 2 months ago

Thank you Abdullah-Gohar.

With your code the Ctrl + C issue is certainly fixed!