Skip to content

NameError: name 'computer' is not defined  #875

@youssefabdelm

Description

@youssefabdelm

Describe the bug

When I run interpreter --os

And then attempt a command like:
Play a boiler room set on youtube

I get a NameError:

▌ OS Control enabled                                                                                                                                                                

To find items on the screen, Open Interpreter has been instructed to send screenshots to api.openinterpreter.com (we do not store them). Add --offline to attempt this locally.       

Make sure that screen recording permissions are enabled for your Terminal or Python environment.                                                                                      

Warning: In this mode, Open Interpreter will not require approval before performing actions. Be ready to close your terminal.                                                         

> Play a boiler room set on youtube
                                                                                                                                                                                      
  The first step is to open YouTube. We can do this by using a keyboard hotkey to open Spotlight and then typing "Safari" to open the browser. Once Safari is open, we can navigate   
  to YouTube by writing the URL in the address bar. Let's start by opening Safari.                                                                                                    
                                                                                                                                                                                      
Expecting value: line 1 column 1 (char 0)
Continuing.

                                                                                                                                                                                      
  computer.keyboard.hotkey("space", "command") # Opens spotlight                                                                                                                      
  computer.keyboard.write("Safari")                                                                                                                                                   
  computer.keyboard.press("enter") # To open Safari                                                                                                                                   
                                                                                                                                                                                      
                                                                                                                                                                                      
  ---------------------------------------------------------------------------                                                                                                         
  NameError                                 Traceback (most recent call last)                                                                                                         
  Input In [4], in <cell line: 2>()                                                                                                                                                   
        1 print('##active_line1##')                                                                                                                                                   
  ----> 2 computer.keyboard.hotkey('space', 'command')                                                                                                                                
        3 print('##active_line2##')                                                                                                                                                   
        4 computer.keyboard.write('Safari')                                                                                                                                           
                                                                                                                                                                                      
  NameError: name 'computer' is not defined                                                                                                                                           
                                                                                                                                                                                      
                                                                                                                                                                                      
  It seems there was a mistake in my attempt to run the code. "computer" is not recognized as defined within the current execution environment. Let's correct this by using the       
  appropriate syntax to execute the code on your machine. We will try to open Safari using the correct approach. Let's run the correct code.                                          
                                                                                                                                                                                      
Expecting value: line 1 column 1 (char 0)
Continuing.

                                                                                                                                                                                      
  # Opens spotlight and types Safari to open the browser                                                                                                                              
  computer.keyboard.hotkey("space", "command")                                                                                                                                        
  computer.keyboard.write("Safari")                                                                                                                                                   
  computer.keyboard.press("enter")                                                                                                                                                    
                                                                                                                                                                                      
                                                                                                                                                                                      
  ---------------------------------------------------------------------------                                                                                                         
  NameError                                 Traceback (most recent call last)                                                                                                         
  Input In [7], in <cell line: 4>()                                                                                                                                                   
        2 pass                                                                                                                                                                        
        3 print('##active_line2##')                                                                                                                                                   
  ----> 4 computer.keyboard.hotkey('space', 'command')                                                                                                                                
        5 print('##active_line3##')                                                                                                                                                   
        6 computer.keyboard.write('Safari')                                                                                                                                           
                                                                                                                                                                                      
  NameError: name 'computer' is not defined                                                                                                                                           

And it just gets stuck in this loop where computer is not defined.

Reproduce

  1. interpreter --os
  2. Play a boiler room set on youtube

Expected behavior

For it to be able to open Safari or my default web browser without a Name Error of computer.

Screenshots

No response

Open Interpreter version

0.2.0

Python version

3.9.6

Operating System name and version

macOS 14.0

Additional context

I have 2 python versions installed. 3.9.6 and 3.10.8. I installed interpreter on both.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions