Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (oi) C:\Users\ivan>interpreter --api_base "https://api.groq.com/openai/v1" --api_key "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" --model "llama3-8b-8192" --context_window 8000 --os --no-llm_supports_vision
- ▌ OS Control enabled
- > podes decirme cuantos mensajes sin leer tengo en el whatsap que esta minimizado en mi pantalla?
- Let's see if we can figure this out.
- First, I'll try to bring the minimized WhatsApp window into focus.
- import computer
- # Focus on the WhatsApp window
- computer.display.view()
- computer.mouse.move("WhatsApp")
- computer.mouse.click()
- # Count the number of unread messages
- count = computer.clipboard.view().count(": )")
- print(f"You have {count} unread messages in WhatsApp")
- Output truncated. Showing the last 2800 characters.
- )
- 285 'timeout': timeout,
- 286 }
- --> 288 run_tesseract(**kwargs)
- 289 filename = f"{kwargs['output_filename_base']}{extsep}{extension}"
- File ~\anaconda3\envs\oi\Lib\site-packages\pytesseract\pytesseract.py:260, in run_tesseract(input_filename, output_filename_base, extension, lang,
- config, nice, timeout)
- 259 else:
- --> 260 raise TesseractNotFoundError()
- 262 with timeout_manager(proc, timeout) as error_string:
- TesseractNotFoundError: tesseract is not installed or it's not in your PATH. See README file for more information.
- During handling of the above exception, another exception occurred:
- Exception Traceback (most recent call last)
- Cell In[11], line 8
- 6 pass
- 7 print('##active_line4##')
- ----> 8 computer.display.view()
- 9 print('##active_line5##')
- 10 computer.mouse.move('WhatsApp')
- File ~\anaconda3\envs\oi\Lib\site-packages\interpreter\core\computer\display\display.py:63, in Display.view(self, show, quadrant)
- 59 def view(self, show=True, quadrant=None):
- import computer
- # Focus on the WhatsApp window
- computer.display.view()
- computer.mouse.move("WhatsApp")
- computer.mouse.click()
- # Count the number of unread messages
- count = computer.clipboard.view().count(": )")
- print(f"You have {count} unread messages in WhatsApp")
- Output truncated. Showing the last 2800 characters.
- )
- 285 'timeout': timeout,
- 286 }
- --> 288 run_tesseract(**kwargs)
- 289 filename = f"{kwargs['output_filename_base']}{extsep}{extension}"
- File ~\anaconda3\envs\oi\Lib\site-packages\pytesseract\pytesseract.py:260, in run_tesseract(input_filename, output_filename_base, extension, lang,
- config, nice, timeout)
- 259 else:
- --> 260 raise TesseractNotFoundError()
- 262 with timeout_manager(proc, timeout) as error_string:
- TesseractNotFoundError: tesseract is not installed or it's not in your PATH. See README file for more information.
- During handling of the above exception, another exception occurred:
- Exception Traceback (most recent call last)
- Cell In[11], line 8
- 6 pass
- 7 print('##active_line4##')
- ----> 8 computer.display.view()
- 9 print('##active_line5##')
- 10 computer.mouse.move('WhatsApp')
- File ~\anaconda3\envs\oi\Lib\site-packages\interpreter\core\computer\display\display.py:63, in Display.view(self, show, quadrant)
- 59 def view(self, show=True, quadrant=None):
- import computer
- # Focus on the WhatsApp window
- computer.display.view()
- computer.mouse.move("WhatsApp")
- computer.mouse.click()
- # Count the number of unread messages
- count = computer.clipboard.view().count(": )")
- print(f"You have {count} unread messages in WhatsApp")
- Output truncated. Showing the last 2800 characters.
- )
- 285 'timeout': timeout,
- 286 }
- --> 288 run_tesseract(**kwargs)
- 289 filename = f"{kwargs['output_filename_base']}{extsep}{extension}"
- File ~\anaconda3\envs\oi\Lib\site-packages\pytesseract\pytesseract.py:260, in run_tesseract(input_filename, output_filename_base, extension, lang,
- config, nice, timeout)
- 259 else:
- --> 260 raise TesseractNotFoundError()
- 262 with timeout_manager(proc, timeout) as error_string:
- TesseractNotFoundError: tesseract is not installed or it's not in your PATH. See README file for more information.
- During handling of the above exception, another exception occurred:
- Exception Traceback (most recent call last)
- Cell In[11], line 8
- 6 pass
- 7 print('##active_line4##')
- ----> 8 computer.display.view()
- 9 print('##active_line5##')
- 10 computer.mouse.move('WhatsApp')
- File ~\anaconda3\envs\oi\Lib\site-packages\interpreter\core\computer\display\display.py:63, in Display.view(self, show, quadrant)
- 59 def view(self, show=True, quadrant=None):
- import computer
- # Focus on the WhatsApp window
- computer.display.view()
- computer.mouse.move("WhatsApp")
- computer.mouse.click()
- # Count the number of unread messages
- count = computer.clipboard.view().count(": )")
- print(f"You have {count} unread messages in WhatsApp")
- Output truncated. Showing the last 2800 characters.
- )
- 285 'timeout': timeout,
- 286 }
- --> 288 run_tesseract(**kwargs)
- 289 filename = f"{kwargs['output_filename_base']}{extsep}{extension}"
- File ~\anaconda3\envs\oi\Lib\site-packages\pytesseract\pytesseract.py:260, in run_tesseract(input_filename, output_filename_base, extension, lang,
- config, nice, timeout)
- 259 else:
- --> 260 raise TesseractNotFoundError()
- 262 with timeout_manager(proc, timeout) as error_string:
- TesseractNotFoundError: tesseract is not installed or it's not in your PATH. See README file for more information.
- During handling of the above exception, another exception occurred:
- Exception Traceback (most recent call last)
- Cell In[11], line 8
- 6 pass
- 7 print('##active_line4##')
- ----> 8 computer.display.view()
- 9 print('##active_line5##')
- 10 computer.mouse.move('WhatsApp')
- File ~\anaconda3\envs\oi\Lib\site-packages\interpreter\core\computer\display\display.py:63, in Display.view(self, show, quadrant)
- 59 def view(self, show=True, quadrant=None):
- import computer
- # Focus on the WhatsApp window
- computer.display.view()
- computer.mouse.move("WhatsApp")
- computer.mouse.click()
- # Count the number of unread messages
- count = computer.clipboard.view().count(": )")
- print(f"You have {count} unread messages in WhatsApp")
- Output truncated. Showing the last 2800 characters.
- )
- 285 'timeout': timeout,
- 286 }
- --> 288 run_tesseract(**kwargs)
- 289 filename = f"{kwargs['output_filename_base']}{extsep}{extension}"
- File ~\anaconda3\envs\oi\Lib\site-packages\pytesseract\pytesseract.py:260, in run_tesseract(input_filename, output_filename_base, extension, lang,
- config, nice, timeout)
- 259 else:
- --> 260 raise TesseractNotFoundError()
- 262 with timeout_manager(proc, timeout) as error_string:
- TesseractNotFoundError: tesseract is not installed or it's not in your PATH. See README file for more information.
- During handling of the above exception, another exception occurred:
- Exception Traceback (most recent call last)
- Cell In[11], line 8
- 6 pass
- 7 print('##active_line4##')
- ----> 8 computer.display.view()
- 9 print('##active_line5##')
- 10 computer.mouse.move('WhatsApp')
- File ~\anaconda3\envs\oi\Lib\site-packages\interpreter\core\computer\display\display.py:63, in Display.view(self, show, quadrant)
- 59 def view(self, show=True, quadrant=None):
- import computer
- # Focus on the WhatsApp window
- computer.display.view()
- computer.mouse.move("WhatsApp")
- computer.mouse.click()
- # Count the number of unread messages
- count = computer.clipboard.view().count(": )")
- print(f"You have {count} unread messages in WhatsApp")
- Output truncated. Showing the last 2800 characters.
- )
- 285 'timeout': timeout,
- 286 }
- --> 288 run_tesseract(**kwargs)
- 289 filename = f"{kwargs['output_filename_base']}{extsep}{extension}"
- File ~\anaconda3\envs\oi\Lib\site-packages\pytesseract\pytesseract.py:260, in run_tesseract(input_filename, output_filename_base, extension, lang,
- config, nice, timeout)
- 259 else:
- --> 260 raise TesseractNotFoundError()
- 262 with timeout_manager(proc, timeout) as error_string:
- TesseractNotFoundError: tesseract is not installed or it's not in your PATH. See README file for more information.
- During handling of the above exception, another exception occurred:
- Exception Traceback (most recent call last)
- Cell In[11], line 8
- 6 pass
- 7 print('##active_line4##')
- ----> 8 computer.display.view()
- 9 print('##active_line5##')
- 10 computer.mouse.move('WhatsApp')
- File ~\anaconda3\envs\oi\Lib\site-packages\interpreter\core\computer\display\display.py:63, in Display.view(self, show, quadrant)
- 59 def view(self, show=True, quadrant=None):
- 60 """
- 61 Redirects to self.screenshot
- 62 """
- ---> 63 return self.screenshot(show, quadrant)
- File ~\anaconda3\envs\oi\Lib\site-packages\interpreter\core\computer\display\display.py:75, in Display.screenshot(self, show, quadrant, active_app_only,
- force_image)
- 71 """
- 72 Shows you what's on the screen by taking a screenshot of the entire screen or a specified quadrant. Returns a `pil_image` `in case you need it
- (rarely). **You almost always want to do this first!**
- 73 """
- 74 if not self.computer.emit_images and force_image == False:
- ---> 75 text = self.get_text_as_list_of_lists()
- 76 pp = pprint.PrettyPrinter(indent=4)
- 77 pretty_text = pp.pformat(text) # language models like it pretty!
- File ~\anaconda3\envs\oi\Lib\site-packages\interpreter\core\computer\display\display.py:258, in Display.get_text_as_list_of_lists(self, screenshot)
- 256 return pytesseract_get_text(screenshot)
- 257 except:
- --> 258 raise Exception(
- 259 "Failed to find text locally.\n\nTo find text in order to use the mouse, please make sure you've installed `pytesseract` along with the
- Tesseract executable (see this Stack Overflow answer for help installing Tesseract:
- https://stackoverflow.com/questions/50951955/pytesseract-tesseractnotfound-error-tesseract-is-not-installed-or-its-not-i)."
- 260 )
- Exception: Failed to find text locally.
- To find text in order to use the mouse, please make sure you've installed `pytesseract` along with the Tesseract executable (see this Stack Overflow
- answer for help installing Tesseract:
- https://stackoverflow.com/questions/50951955/pytesseract-tesseractnotfound-error-tesseract-is-not-installed-or-its-not-i).
- It looks like there was an error in the code. I believe it's because Tesseract is not installed or not in the PATH.
- Before we can continue, we need to install and configure Tesseract.
- Let me help you with that!
- Let's try to install Tesseract and configure it.
- !pip install pytesseract
- !pip install Pillow
- !pip install opencv-
- import pytesseract
- import pillow
- import cv2
- print("Tesseract installed!")
- Requirement already satisfied: pytesseract in c:\users\ivan\anaconda3\envs\oi\lib\site-packages (0.3.10)
- Requirement already satisfied: packaging>=21.3 in c:\users\ivan\anaconda3\envs\oi\lib\site-packages (from pytesseract) (23.2)
- Requirement already satisfied: Pillow>=8.0.0 in c:\users\ivan\anaconda3\envs\oi\lib\site-packages (from pytesseract) (10.2.0)
- Requirement already satisfied: Pillow in c:\users\ivan\anaconda3\envs\oi\lib\site-packages (10.2.0)
- ERROR: Invalid requirement: 'opencv-'
- ---------------------------------------------------------------------------
- ModuleNotFoundError Traceback (most recent call last)
- Cell In[20], line 5
- 3 get_ipython().system('pip install opencv-')
- 4 import pytesseract
- ----> 5 import pillow
- 6 import cv2
- 7 print("Tesseract installed!")
- ModuleNotFoundError: No module named 'pillow'
- It looks like we missed installing Pillow!
- Let's fix this. We'll install Pillow and then import it correctly.
- Here's the updated code:
- !pip install Pillow
- import pytesseract
- import pillow
- import cv2
- print("Tesseract installed!")
- Requirement already satisfied: Pillow in c:\users\ivan\anaconda3\envs\oi\lib\site-packages (10.2.0)
- ---------------------------------------------------------------------------
- ModuleNotFoundError Traceback (most recent call last)
- Cell In[26], line 3
- 1 get_ipython().system('pip install Pillow')
- 2 import pytesseract
- ----> 3 import pillow
- 4 import cv2
- 5 print("Tesseract installed!")
- ModuleNotFoundError: No module named 'pillow'
- Let's try to import Pillow correctly.
- Here's the updated code:
- from PIL import Image
- print("Pillow imported!")
- Pillow imported!
- You're back to the original goal!
- Let's get back to the task at hand.
- To find out how many unread messages you have in WhatsApp, we need to get the number of messages in the WhatsApp chat and then count the ones that are
- unchecked.
- Here's the updated code:
- import computer
- # Focus on the WhatsApp window
- computer.display.view()
- computer.mouse.move("WhatsApp")
- computer.mouse.click()
- # Count the number of unread messages
- count = computer.clipboard.view().count(":))")
- print(f"You have {count} unread messages in WhatsApp")
- Output truncated. Showing the last 2800 characters.
- )
- 285 'timeout': timeout,
- 286 }
- --> 288 run_tesseract(**kwargs)
- 289 filename = f"{kwargs['output_filename_base']}{extsep}{extension}"
- File ~\anaconda3\envs\oi\Lib\site-packages\pytesseract\pytesseract.py:260, in run_tesseract(input_filename, output_filename_base, extension, lang,
- config, nice, timeout)
- 259 else:
- --> 260 raise TesseractNotFoundError()
- 262 with timeout_manager(proc, timeout) as error_string:
- TesseractNotFoundError: tesseract is not installed or it's not in your PATH. See README file for more information.
- During handling of the above exception, another exception occurred:
- Exception Traceback (most recent call last)
- Cell In[38], line 8
- 6 pass
- 7 print('##active_line4##')
- ----> 8 computer.display.view()
- 9 print('##active_line5##')
- 10 computer.mouse.move('WhatsApp')
- File ~\anaconda3\envs\oi\Lib\site-packages\interpreter\core\computer\display\display.py:63, in Display.view(self, show, quadrant)
- 59 def view(self, show=True, quadrant=None):
- import computer
- # Focus on the WhatsApp window
- computer.display.view()
- computer.mouse.move("WhatsApp")
- computer.mouse.click()
- # Count the number of unread messages
- count = computer.clipboard.view().count(":))")
- print(f"You have {count} unread messages in WhatsApp")
- Output truncated. Showing the last 2800 characters.
- )
- 285 'timeout': timeout,
- 286 }
- --> 288 run_tesseract(**kwargs)
- 289 filename = f"{kwargs['output_filename_base']}{extsep}{extension}"
- File ~\anaconda3\envs\oi\Lib\site-packages\pytesseract\pytesseract.py:260, in run_tesseract(input_filename, output_filename_base, extension, lang,
- config, nice, timeout)
- 259 else:
- --> 260 raise TesseractNotFoundError()
- 262 with timeout_manager(proc, timeout) as error_string:
- TesseractNotFoundError: tesseract is not installed or it's not in your PATH. See README file for more information.
- During handling of the above exception, another exception occurred:
- Exception Traceback (most recent call last)
- Cell In[38], line 8
- 6 pass
- 7 print('##active_line4##')
- ----> 8 computer.display.view()
- 9 print('##active_line5##')
- 10 computer.mouse.move('WhatsApp')
- File ~\anaconda3\envs\oi\Lib\site-packages\interpreter\core\computer\display\display.py:63, in Display.view(self, show, quadrant)
- 59 def view(self, show=True, quadrant=None):
- import computer
- # Focus on the WhatsApp window
- computer.display.view()
- computer.mouse.move("WhatsApp")
- computer.mouse.click()
- # Count the number of unread messages
- count = computer.clipboard.view().count(":))")
- print(f"You have {count} unread messages in WhatsApp")
- Output truncated. Showing the last 2800 characters.
- )
- 285 'timeout': timeout,
- 286 }
- --> 288 run_tesseract(**kwargs)
- 289 filename = f"{kwargs['output_filename_base']}{extsep}{extension}"
- File ~\anaconda3\envs\oi\Lib\site-packages\pytesseract\pytesseract.py:260, in run_tesseract(input_filename, output_filename_base, extension, lang,
- config, nice, timeout)
- 259 else:
- --> 260 raise TesseractNotFoundError()
- 262 with timeout_manager(proc, timeout) as error_string:
- TesseractNotFoundError: tesseract is not installed or it's not in your PATH. See README file for more information.
- During handling of the above exception, another exception occurred:
- Exception Traceback (most recent call last)
- Cell In[38], line 8
- 6 pass
- 7 print('##active_line4##')
- ----> 8 computer.display.view()
- 9 print('##active_line5##')
- 10 computer.mouse.move('WhatsApp')
- File ~\anaconda3\envs\oi\Lib\site-packages\interpreter\core\computer\display\display.py:63, in Display.view(self, show, quadrant)
- 59 def view(self, show=True, quadrant=None):
- import computer
- # Focus on the WhatsApp window
- computer.display.view()
- computer.mouse.move("WhatsApp")
- computer.mouse.click()
- # Count the number of unread messages
- count = computer.clipboard.view().count(":))")
- print(f"You have {count} unread messages in WhatsApp")
- Output truncated. Showing the last 2800 characters.
- )
- 285 'timeout': timeout,
- 286 }
- --> 288 run_tesseract(**kwargs)
- 289 filename = f"{kwargs['output_filename_base']}{extsep}{extension}"
- File ~\anaconda3\envs\oi\Lib\site-packages\pytesseract\pytesseract.py:260, in run_tesseract(input_filename, output_filename_base, extension, lang,
- config, nice, timeout)
- 259 else:
- --> 260 raise TesseractNotFoundError()
- 262 with timeout_manager(proc, timeout) as error_string:
- TesseractNotFoundError: tesseract is not installed or it's not in your PATH. See README file for more information.
- During handling of the above exception, another exception occurred:
- Exception Traceback (most recent call last)
- Cell In[38], line 8
- 6 pass
- 7 print('##active_line4##')
- ----> 8 computer.display.view()
- 9 print('##active_line5##')
- 10 computer.mouse.move('WhatsApp')
- File ~\anaconda3\envs\oi\Lib\site-packages\interpreter\core\computer\display\display.py:63, in Display.view(self, show, quadrant)
- 59 def view(self, show=True, quadrant=None):
- import computer
- # Focus on the WhatsApp window
- computer.display.view()
- computer.mouse.move("WhatsApp")
- computer.mouse.click()
- # Count the number of unread messages
- count = computer.clipboard.view().count(":))")
- print(f"You have {count} unread messages in WhatsApp")
- Output truncated. Showing the last 2800 characters.
- )
- 285 'timeout': timeout,
- 286 }
- --> 288 run_tesseract(**kwargs)
- 289 filename = f"{kwargs['output_filename_base']}{extsep}{extension}"
- File ~\anaconda3\envs\oi\Lib\site-packages\pytesseract\pytesseract.py:260, in run_tesseract(input_filename, output_filename_base, extension, lang,
- config, nice, timeout)
- 259 else:
- --> 260 raise TesseractNotFoundError()
- 262 with timeout_manager(proc, timeout) as error_string:
- TesseractNotFoundError: tesseract is not installed or it's not in your PATH. See README file for more information.
- During handling of the above exception, another exception occurred:
- Exception Traceback (most recent call last)
- Cell In[38], line 8
- 6 pass
- 7 print('##active_line4##')
- ----> 8 computer.display.view()
- 9 print('##active_line5##')
- 10 computer.mouse.move('WhatsApp')
- File ~\anaconda3\envs\oi\Lib\site-packages\interpreter\core\computer\display\display.py:63, in Display.view(self, show, quadrant)
- 59 def view(self, show=True, quadrant=None):
- import computer
- # Focus on the WhatsApp window
- computer.display.view()
- computer.mouse.move("WhatsApp")
- computer.mouse.click()
- # Count the number of unread messages
- count = computer.clipboard.view().count(":))")
- print(f"You have {count} unread messages in WhatsApp")
- Output truncated. Showing the last 2800 characters.
- )
- 285 'timeout': timeout,
- 286 }
- --> 288 run_tesseract(**kwargs)
- 289 filename = f"{kwargs['output_filename_base']}{extsep}{extension}"
- File ~\anaconda3\envs\oi\Lib\site-packages\pytesseract\pytesseract.py:260, in run_tesseract(input_filename, output_filename_base, extension, lang,
- config, nice, timeout)
- 259 else:
- --> 260 raise TesseractNotFoundError()
- 262 with timeout_manager(proc, timeout) as error_string:
- TesseractNotFoundError: tesseract is not installed or it's not in your PATH. See README file for more information.
- During handling of the above exception, another exception occurred:
- Exception Traceback (most recent call last)
- Cell In[38], line 8
- 6 pass
- 7 print('##active_line4##')
- ----> 8 computer.display.view()
- 9 print('##active_line5##')
- 10 computer.mouse.move('WhatsApp')
- File ~\anaconda3\envs\oi\Lib\site-packages\interpreter\core\computer\display\display.py:63, in Display.view(self, show, quadrant)
- 59 def view(self, show=True, quadrant=None):
- 60 """
- 61 Redirects to self.screenshot
- 62 """
- ---> 63 return self.screenshot(show, quadrant)
- File ~\anaconda3\envs\oi\Lib\site-packages\interpreter\core\computer\display\display.py:75, in Display.screenshot(self, show, quadrant, active_app_only,
- force_image)
- 71 """
- 72 Shows you what's on the screen by taking a screenshot of the entire screen or a specified quadrant. Returns a `pil_image` `in case you need it
- (rarely). **You almost always want to do this first!**
- 73 """
- 74 if not self.computer.emit_images and force_image == False:
- ---> 75 text = self.get_text_as_list_of_lists()
- 76 pp = pprint.PrettyPrinter(indent=4)
- 77 pretty_text = pp.pformat(text) # language models like it pretty!
- File ~\anaconda3\envs\oi\Lib\site-packages\interpreter\core\computer\display\display.py:258, in Display.get_text_as_list_of_lists(self, screenshot)
- 256 return pytesseract_get_text(screenshot)
- 257 except:
- --> 258 raise Exception(
- 259 "Failed to find text locally.\n\nTo find text in order to use the mouse, please make sure you've installed `pytesseract` along with the
- Tesseract executable (see this Stack Overflow answer for help installing Tesseract:
- https://stackoverflow.com/questions/50951955/pytesseract-tesseractnotfound-error-tesseract-is-not-installed-or-its-not-i)."
- 260 )
- Exception: Failed to find text locally.
- To find text in order to use the mouse, please make sure you've installed `pytesseract` along with the Tesseract executable (see this Stack Overflow
- answer for help installing Tesseract:
- https://stackoverflow.com/questions/50951955/pytesseract-tesseractnotfound-error-tesseract-is-not-installed-or-its-not-i).
- It looks like we have an issue with installation!
- Let's try installingpytesseract correctly.
- Here's the updated code:
- !pip install pytesseract
- !pip install pillow
- import pytesseract
- from PIL import Image
- import cv2
- # Rest of the code...
- Requirement already satisfied: pytesseract in c:\users\ivan\anaconda3\envs\oi\lib\site-packages (0.3.10)
- Requirement already satisfied: packaging>=21.3 in c:\users\ivan\anaconda3\envs\oi\lib\site-packages (from pytesseract) (23.2)
- Requirement already satisfied: Pillow>=8.0.0 in c:\users\ivan\anaconda3\envs\oi\lib\site-packages (from pytesseract) (10.2.0)
- Requirement already satisfied: pillow in c:\users\ivan\anaconda3\envs\oi\lib\site-packages (10.2.0)
- It looks like we're all set!
- Let's run the code again and see what happens.
- Here's the updated code:
- import pytesseract
- from PIL import Image
- import cv2
- import computer
- # Focus on the WhatsApp window
- computer.mouse.move("WhatsApp")
- computer.mouse.click()
- # Count the number of unread messages
- count = computer.clipboard.view().count(":))")
- print(f"You have {count} unread messages in WhatsApp")
- Output truncated. Showing the last 2800 characters.
- File ~\anaconda3\envs\oi\Lib\site-packages\pytesseract\pytesseract.py:260, in run_tesseract(input_filename, output_filename_base, extension, lang,
- config, nice, timeout)
- 259 else:
- --> 260 raise TesseractNotFoundError()
- 262 with timeout_manager(proc, timeout) as error_string:
- TesseractNotFoundError: tesseract is not installed or it's not in your PATH. See README file for more information.
- During handling of the above exception, another exception occurred:
- Exception Traceback (most recent call last)
- Cell In[53], line 14
- 12 pass
- 13 print('##active_line7##')
- ---> 14 computer.mouse.move('WhatsApp')
- 15 print('##active_line8##')
- 16 computer.mouse.click()
- File ~\anaconda3\envs\oi\Lib\site-packages\interpreter\core\computer\mouse\mouse.py:53, in Mouse.move(self, x, y, icon, text, screenshot, *args)
- 50 text = args[0]
- 52 if screenshot == None:
- ---> 53 screenshot = self.computer.display.screenshot(show=False)
- import pytesseract
- from PIL import Image
- import cv2
- import computer
- # Focus on the WhatsApp window
- computer.mouse.move("WhatsApp")
- computer.mouse.click()
- # Count the number of unread messages
- count = computer.clipboard.view().count(":))")
- print(f"You have {count} unread messages in WhatsApp")
- Output truncated. Showing the last 2800 characters.
- File ~\anaconda3\envs\oi\Lib\site-packages\pytesseract\pytesseract.py:260, in run_tesseract(input_filename, output_filename_base, extension, lang,
- config, nice, timeout)
- 259 else:
- --> 260 raise TesseractNotFoundError()
- 262 with timeout_manager(proc, timeout) as error_string:
- TesseractNotFoundError: tesseract is not installed or it's not in your PATH. See README file for more information.
- During handling of the above exception, another exception occurred:
- Exception Traceback (most recent call last)
- Cell In[53], line 14
- 12 pass
- 13 print('##active_line7##')
- ---> 14 computer.mouse.move('WhatsApp')
- 15 print('##active_line8##')
- 16 computer.mouse.click()
- File ~\anaconda3\envs\oi\Lib\site-packages\interpreter\core\computer\mouse\mouse.py:53, in Mouse.move(self, x, y, icon, text, screenshot, *args)
- 50 text = args[0]
- 52 if screenshot == None:
- ---> 53 screenshot = self.computer.display.screenshot(show=False)
- import pytesseract
- from PIL import Image
- import cv2
- import computer
- # Focus on the WhatsApp window
- computer.mouse.move("WhatsApp")
- computer.mouse.click()
- # Count the number of unread messages
- count = computer.clipboard.view().count(":))")
- print(f"You have {count} unread messages in WhatsApp")
- Output truncated. Showing the last 2800 characters.
- File ~\anaconda3\envs\oi\Lib\site-packages\pytesseract\pytesseract.py:260, in run_tesseract(input_filename, output_filename_base, extension, lang,
- config, nice, timeout)
- 259 else:
- --> 260 raise TesseractNotFoundError()
- 262 with timeout_manager(proc, timeout) as error_string:
- TesseractNotFoundError: tesseract is not installed or it's not in your PATH. See README file for more information.
- During handling of the above exception, another exception occurred:
- Exception Traceback (most recent call last)
- Cell In[53], line 14
- 12 pass
- 13 print('##active_line7##')
- ---> 14 computer.mouse.move('WhatsApp')
- 15 print('##active_line8##')
- 16 computer.mouse.click()
- File ~\anaconda3\envs\oi\Lib\site-packages\interpreter\core\computer\mouse\mouse.py:53, in Mouse.move(self, x, y, icon, text, screenshot, *args)
- 50 text = args[0]
- 52 if screenshot == None:
- ---> 53 screenshot = self.computer.display.screenshot(show=False)
- import pytesseract
- from PIL import Image
- import cv2
- import computer
- # Focus on the WhatsApp window
- computer.mouse.move("WhatsApp")
- computer.mouse.click()
- # Count the number of unread messages
- count = computer.clipboard.view().count(":))")
- print(f"You have {count} unread messages in WhatsApp")
- Output truncated. Showing the last 2800 characters.
- File ~\anaconda3\envs\oi\Lib\site-packages\pytesseract\pytesseract.py:260, in run_tesseract(input_filename, output_filename_base, extension, lang,
- config, nice, timeout)
- 259 else:
- --> 260 raise TesseractNotFoundError()
- 262 with timeout_manager(proc, timeout) as error_string:
- TesseractNotFoundError: tesseract is not installed or it's not in your PATH. See README file for more information.
- During handling of the above exception, another exception occurred:
- Exception Traceback (most recent call last)
- Cell In[53], line 14
- 12 pass
- 13 print('##active_line7##')
- ---> 14 computer.mouse.move('WhatsApp')
- 15 print('##active_line8##')
- 16 computer.mouse.click()
- File ~\anaconda3\envs\oi\Lib\site-packages\interpreter\core\computer\mouse\mouse.py:53, in Mouse.move(self, x, y, icon, text, screenshot, *args)
- 50 text = args[0]
- 52 if screenshot == None:
- ---> 53 screenshot = self.computer.display.screenshot(show=False)
- import pytesseract
- from PIL import Image
- import cv2
- import computer
- # Focus on the WhatsApp window
- computer.mouse.move("WhatsApp")
- computer.mouse.click()
- # Count the number of unread messages
- count = computer.clipboard.view().count(":))")
- print(f"You have {count} unread messages in WhatsApp")
- Output truncated. Showing the last 2800 characters.
- File ~\anaconda3\envs\oi\Lib\site-packages\pytesseract\pytesseract.py:260, in run_tesseract(input_filename, output_filename_base, extension, lang,
- config, nice, timeout)
- 259 else:
- --> 260 raise TesseractNotFoundError()
- 262 with timeout_manager(proc, timeout) as error_string:
- TesseractNotFoundError: tesseract is not installed or it's not in your PATH. See README file for more information.
- During handling of the above exception, another exception occurred:
- Exception Traceback (most recent call last)
- Cell In[53], line 14
- 12 pass
- 13 print('##active_line7##')
- ---> 14 computer.mouse.move('WhatsApp')
- 15 print('##active_line8##')
- 16 computer.mouse.click()
- File ~\anaconda3\envs\oi\Lib\site-packages\interpreter\core\computer\mouse\mouse.py:53, in Mouse.move(self, x, y, icon, text, screenshot, *args)
- 50 text = args[0]
- 52 if screenshot == None:
- ---> 53 screenshot = self.computer.display.screenshot(show=False)
- import pytesseract
- from PIL import Image
- import cv2
- import computer
- # Focus on the WhatsApp window
- computer.mouse.move("WhatsApp")
- computer.mouse.click()
- # Count the number of unread messages
- count = computer.clipboard.view().count(":))")
- print(f"You have {count} unread messages in WhatsApp")
- Output truncated. Showing the last 2800 characters.
- File ~\anaconda3\envs\oi\Lib\site-packages\pytesseract\pytesseract.py:260, in run_tesseract(input_filename, output_filename_base, extension, lang,
- config, nice, timeout)
- 259 else:
- --> 260 raise TesseractNotFoundError()
- 262 with timeout_manager(proc, timeout) as error_string:
- TesseractNotFoundError: tesseract is not installed or it's not in your PATH. See README file for more information.
- During handling of the above exception, another exception occurred:
- Exception Traceback (most recent call last)
- Cell In[53], line 14
- 12 pass
- 13 print('##active_line7##')
- ---> 14 computer.mouse.move('WhatsApp')
- 15 print('##active_line8##')
- 16 computer.mouse.click()
- File ~\anaconda3\envs\oi\Lib\site-packages\interpreter\core\computer\mouse\mouse.py:53, in Mouse.move(self, x, y, icon, text, screenshot, *args)
- 50 text = args[0]
- 52 if screenshot == None:
- ---> 53 screenshot = self.computer.display.screenshot(show=False)
- 55 coordinates = self.computer.display.find(
- 56 '"' + text + '"', screenshot=screenshot
- 57 )
- 59 is_fuzzy = any([c["similarity"] != 1 for c in coordinates])
- File ~\anaconda3\envs\oi\Lib\site-packages\interpreter\core\computer\display\display.py:75, in Display.screenshot(self, show, quadrant, active_app_only,
- force_image)
- 71 """
- 72 Shows you what's on the screen by taking a screenshot of the entire screen or a specified quadrant. Returns a `pil_image` `in case you need it
- (rarely). **You almost always want to do this first!**
- 73 """
- 74 if not self.computer.emit_images and force_image == False:
- ---> 75 text = self.get_text_as_list_of_lists()
- 76 pp = pprint.PrettyPrinter(indent=4)
- 77 pretty_text = pp.pformat(text) # language models like it pretty!
- File ~\anaconda3\envs\oi\Lib\site-packages\interpreter\core\computer\display\display.py:258, in Display.get_text_as_list_of_lists(self, screenshot)
- 256 return pytesseract_get_text(screenshot)
- 257 except:
- --> 258 raise Exception(
- 259 "Failed to find text locally.\n\nTo find text in order to use the mouse, please make sure you've installed `pytesseract` along with the
- Tesseract executable (see this Stack Overflow answer for help installing Tesseract:
- https://stackoverflow.com/questions/50951955/pytesseract-tesseractnotfound-error-tesseract-is-not-installed-or-its-not-i)."
- 260 )
- Exception: Failed to find text locally.
- To find text in order to use the mouse, please make sure you've installed `pytesseract` along with the Tesseract executable (see this Stack Overflow
- answer for help installing Tesseract:
- https://stackoverflow.com/questions/50951955/pytesseract-tesseractnotfound-error-tesseract-is-not-installed-or-its-not-i).
- It seems like we've hit a roadblock!
- Let's try to install Tesseract and see if that solves the issue. Remember to follow the link provided in the error message for help installing
- Tesseract.
- Here's the updated code:
- !pip install tesseract-ocr
- Output truncated. Showing the last 2800 characters.
- ror: subprocess-exited-with-error
- python setup.py bdist_wheel did not run successfully.
- exit code: 1
- [29 lines of output]
- C:\Users\ivan\anaconda3\envs\oi\Lib\site-packages\setuptools\dist.py:498: SetuptoolsDeprecationWarning: Invalid dash-separated options
- !!
- ********************************************************************************
- Usage of dash-separated 'description-file' will not be supported in future
- versions. Please use the underscore name 'description_file' instead.
- This deprecation is overdue, please update your project and remove deprecated
- calls to avoid build errors in the future.
- See https://setuptools.pypa.io/en/latest/userguide/declarative_config.html for details.
- !pip install tesseract-ocr
- Output truncated. Showing the last 2800 characters.
- ror: subprocess-exited-with-error
- python setup.py bdist_wheel did not run successfully.
- exit code: 1
- [29 lines of output]
- C:\Users\ivan\anaconda3\envs\oi\Lib\site-packages\setuptools\dist.py:498: SetuptoolsDeprecationWarning: Invalid dash-separated options
- !!
- ********************************************************************************
- Usage of dash-separated 'description-file' will not be supported in future
- versions. Please use the underscore name 'description_file' instead.
- This deprecation is overdue, please update your project and remove deprecated
- calls to avoid build errors in the future.
- See https://setuptools.pypa.io/en/latest/userguide/declarative_config.html for details.
- !pip install tesseract-ocr
- Output truncated. Showing the last 2800 characters.
- ror: subprocess-exited-with-error
- python setup.py bdist_wheel did not run successfully.
- exit code: 1
- [29 lines of output]
- C:\Users\ivan\anaconda3\envs\oi\Lib\site-packages\setuptools\dist.py:498: SetuptoolsDeprecationWarning: Invalid dash-separated options
- !!
- ********************************************************************************
- Usage of dash-separated 'description-file' will not be supported in future
- versions. Please use the underscore name 'description_file' instead.
- This deprecation is overdue, please update your project and remove deprecated
- calls to avoid build errors in the future.
- See https://setuptools.pypa.io/en/latest/userguide/declarative_config.html for details.
- !pip install tesseract-ocr
- Output truncated. Showing the last 2800 characters.
- ror: subprocess-exited-with-error
- python setup.py bdist_wheel did not run successfully.
- exit code: 1
- [29 lines of output]
- C:\Users\ivan\anaconda3\envs\oi\Lib\site-packages\setuptools\dist.py:498: SetuptoolsDeprecationWarning: Invalid dash-separated options
- !!
- ********************************************************************************
- Usage of dash-separated 'description-file' will not be supported in future
- versions. Please use the underscore name 'description_file' instead.
- This deprecation is overdue, please update your project and remove deprecated
- calls to avoid build errors in the future.
- See https://setuptools.pypa.io/en/latest/userguide/declarative_config.html for details.
- !pip install tesseract-ocr
- Output truncated. Showing the last 2800 characters.
- ror: subprocess-exited-with-error
- python setup.py bdist_wheel did not run successfully.
- exit code: 1
- [29 lines of output]
- C:\Users\ivan\anaconda3\envs\oi\Lib\site-packages\setuptools\dist.py:498: SetuptoolsDeprecationWarning: Invalid dash-separated options
- !!
- ********************************************************************************
- Usage of dash-separated 'description-file' will not be supported in future
- versions. Please use the underscore name 'description_file' instead.
- This deprecation is overdue, please update your project and remove deprecated
- calls to avoid build errors in the future.
- See https://setuptools.pypa.io/en/latest/userguide/declarative_config.html for details.
- !pip install tesseract-ocr
- Output truncated. Showing the last 2800 characters.
- ror: subprocess-exited-with-error
- python setup.py bdist_wheel did not run successfully.
- exit code: 1
- [29 lines of output]
- C:\Users\ivan\anaconda3\envs\oi\Lib\site-packages\setuptools\dist.py:498: SetuptoolsDeprecationWarning: Invalid dash-separated options
- !!
- ********************************************************************************
- Usage of dash-separated 'description-file' will not be supported in future
- versions. Please use the underscore name 'description_file' instead.
- This deprecation is overdue, please update your project and remove deprecated
- calls to avoid build errors in the future.
- See https://setuptools.pypa.io/en/latest/userguide/declarative_config.html for details.
- ********************************************************************************
- !!
- opt = self.warn_dash_deprecation(opt, section)
- running bdist_wheel
- running build
- running build_py
- file tesseract_ocr.py (for module tesseract_ocr) not found
- file tesseract_ocr.py (for module tesseract_ocr) not found
- running build_ext
- building 'tesseract_ocr' extension
- creating build
- creating build\temp.win-amd64-cpython-311
- creating build\temp.win-amd64-cpython-311\Release
- "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD
- -IC:\Users\ivan\anaconda3\envs\oi\include -IC:\Users\ivan\anaconda3\envs\oi\Include "-IC:\Program Files\Microsoft Visual
- Studio\2022\Community\VC\Tools\MSVC\14.38.33130\include" "-IC:\Program Files\Microsoft Visual
- Studio\2022\Community\VC\Tools\MSVC\14.38.33130\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include"
- "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um" "-IC:\Program
- Files (x86)\Windows Kits\10\\include\10.0.22621.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\winrt" "-IC:\Program Files
- (x86)\Windows Kits\10\\include\10.0.22621.0\\cppwinrt" /EHsc /Tptesseract_ocr.cpp /Fobuild\temp.win-amd64-cpython-311\Release\tesseract_ocr.obj
- tesseract_ocr.cpp
- tesseract_ocr.cpp(264): fatal error C1083: Cannot open include file: 'leptonica/allheaders.h': No such file or directory
- error: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.38.33130\\bin\\HostX86\\x64\\cl.exe' failed with exit
- code 2
- note: This error originates from a subprocess, and is likely not a problem with pip.
- ERROR: Failed building wheel for tesseract-ocr
- ERROR: Could not build wheels for tesseract-ocr, which is required to install pyproject.toml-based projects
- It looks like we've encountered an error when trying to install Tesseract-OCR. It seems like there was a problem building the wheel for the
- Tesseract-OCR package.
- Don't worry! We can try to troubleshoot this issue further. Let's first check if the package is already installed:
- import os
- import platform
- # Check if Tesseract-OCR is installed
- if not os.path.exists(os.path.join(os.environ['USERPROFILE'], 'Anaconda3', 'envs', 'oi', 'Lib', 'site-packages', 'pytesseract')):
- print("Tesseract-OCR is not installed.")
- # Try to install Tesseract-OCR
- try:
- !pip install tesseract-ocr
- except Exception as e:
- print(f"Error: {str(e)}")
- # Check if installation was successful
- if not os.path.exists(os.path.join(os.environ['USERPROFILE'], 'Anaconda3', 'envs', 'oi', 'Lib', 'site-packages', 'pytesseract')):
- print("Failed to install Tesseract-OCR.")
- else:
- print("Tesseract-OCR installed successfully.")
- Let's summarize what's happening on-screen.
- # Ensure we're in the right window
- computer.switch_desktop()
- # Search Google for "Tesseract OCR"
- computer.browser.search("Tesseract OCR")
- # Wait for a few seconds to load the results
- import time
- time.sleep(5)
- # Take a screenshot to verify the results are correct
- import pytesseract
- from PIL import ImageGrab
- img = ImageGrab.grab(bbox=(0, 0, 1920, 1080))
- img.save("screenshot.png")
- ---------------------------------------------------------------------------
- AttributeError Traceback (most recent call last)
- Cell In[77], line 4
- 2 pass
- 3 print('##active_line2##')
- ----> 4 computer.switch_desktop()
- 5 print('##active_line3##')
- 6 pass
- AttributeError: 'Computer' object has no attribute 'switch_desktop'
- Let's try to switch to a new active window.
- Here's a Python code that switches to the new active window:
- import computer
- computer.keyboard.write("winkey+a") # Simulate pressing the Win key and 'a' key together to activate the application menu
- [IPKernelApp] WARNING | Parent appears to have exited, shutting down.
- [IPKernelApp] WARNING | Parent appears to have exited, shutting down.
- Python Version: 3.11.7
- Pip Version: 23.3.1
- Open-interpreter Version: cmd: Open Interpreter 0.2.4 New Computer Update
- , pkg: 0.2.4
- OS Version and Architecture: Windows-10-10.0.19045-SP0
- CPU Info: Intel64 Family 6 Model 165 Stepping 5, GenuineIntel
- RAM Info: 31.87 GB, used: 6.94, free: 24.93
- # Interpreter Info
- Vision: False
- Model: openai/llama3-8b-8192
- Function calling: False
- Context window: 8000
- Max tokens: 4096
- Auto run: True
- API base: https://api.groq.com/openai/v1
- Offline: False
- Curl output: Not local
- # Messages
- System Message: You are Open Interpreter, a world-class programmer that can complete any goal by executing code.
- When you write code, it will be executed **on the user's machine**. The user has given you **full and complete permission** to execute any code necessary to complete the task.
- When a user refers to a filename, they're likely referring to an existing file in the directory you're currently executing code in.
- In general, try to make plans with as few steps as possible. As for actually executing code to carry out that plan, **don't try to do everything in one code block.** You should try something, print information about it, then continue from there in tiny, informed steps. You will never get it on the first try, and attempting it in one go will often lead to errors you cant see.
- Manually summarize text.
- Do not try to write code that attempts the entire task at once, and verify at each step whether or not you're on track.
- # Computer
- You may use the `computer` Python module to complete tasks:
- ```python
- computer.browser.search(query) # Silently searches Google for the query, returns result. The user's browser is unaffected. (does not open a browser!)
- computer.display.view() # Shows you what's on the screen, returns a `pil_image` `in case you need it (rarely). **You almost always want to do this first!**
- computer.keyboard.hotkey(" ", "command") # Opens spotlight (very useful)
- computer.keyboard.write("hello")
- # Use this to click text:
- computer.mouse.click("text onscreen") # This clicks on the UI element with that text. Use this **frequently** and get creative! To click a video, you could pass the *timestamp* (which is usually written on the thumbnail) into this.
- # Use this to click an icon, button, or other symbol:
- computer.mouse.click(icon="gear icon") # Moves mouse to the icon with that description. Use this very often.
- computer.mouse.move("open recent >") # This moves the mouse over the UI element with that text. Many dropdowns will disappear if you click them. You have to hover over items to reveal more.
- computer.mouse.click(x=500, y=500) # Use this very, very rarely. It's highly inaccurate
- computer.mouse.scroll(-10) # Scrolls down. If you don't find some text on screen that you expected to be there, you probably want to do this
- x, y = computer.display.center() # Get your bearings
- computer.clipboard.view() # Returns contents of clipboard
- computer.os.get_selected_text() # Use frequently. If editing text, the user often wants this
- {{
- import platform
- if platform.system() == 'Darwin':
- print('''
- computer.browser.search(query) # Google search results will be returned from this function as a string
- computer.files.edit(path_to_file, original_text, replacement_text) # Edit a file
- computer.calendar.create_event(title="Meeting", start_date=datetime.datetime.now(), end=datetime.datetime.now() + datetime.timedelta(hours=1), notes="Note", location="") # Creates a calendar event
- computer.calendar.get_events(start_date=datetime.date.today(), end_date=None) # Get events between dates. If end_date is None, only gets events for start_date
- computer.calendar.delete_event(event_title="Meeting", start_date=datetime.datetime) # Delete a specific event with a matching title and start date, you may need to get use get_events() to find the specific event object first
- computer.contacts.get_phone_number("John Doe")
- computer.contacts.get_email_address("John Doe")
- computer.mail.send("john@email.com", "Meeting Reminder", "Reminder that our meeting is at 3pm today.", ["path/to/attachment.pdf", "path/to/attachment2.pdf"]) # Send an email with a optional attachments
- computer.mail.get(4, unread=True) # Returns the {number} of unread emails, or all emails if False is passed
- computer.mail.unread_count() # Returns the number of unread emails
- computer.sms.send("555-123-4567", "Hello from the computer!") # Send a text message. MUST be a phone number, so use computer.contacts.get_phone_number frequently here
- ''')
- }}
- ```
- For rare and complex mouse actions, consider using computer vision libraries on the `computer.display.view()` `pil_image` to produce a list of coordinates for the mouse to move/drag to.
- If the user highlighted text in an editor, then asked you to modify it, they probably want you to `keyboard.write` over their version of the text.
- Tasks are 100% computer-based. DO NOT simply write long messages to the user to complete tasks. You MUST put your text back into the program they're using to deliver your text!
- Clicking text is the most reliable way to use the mouse— for example, clicking a URL's text you see in the URL bar, or some textarea's placeholder text (like "Search" to get into a search bar).
- Applescript might be best for some tasks.
- If you use `plt.show()`, the resulting image will be sent to you. However, if you use `PIL.Image.show()`, the resulting image will NOT be sent to you.
- It is very important to make sure you are focused on the right application and window. Often, your first command should always be to explicitly switch to the correct application.
- When searching the web, use query parameters. For example, https://www.amazon.com/s?k=monitor
- Try multiple methods before saying the task is impossible. **You can do it!**
- # Critical Routine Procedure for Multi-Step Tasks
- Include `computer.display.view()` after a 2 second delay at the end of _every_ code block to verify your progress, then answer these questions in extreme detail:
- 1. Generally, what is happening on-screen?
- 2. What is the active app?
- 3. What hotkeys does this app support that might get be closer to my goal?
- 4. What text areas are active, if any?
- 5. What text is selected?
- 6. What options could you take next to get closer to your goal?
- {{
- # Add window information
- try:
- import pywinctl
- active_window = pywinctl.getActiveWindow()
- if active_window:
- app_info = ""
- if "_appName" in active_window.__dict__:
- app_info += (
- "Active Application: " + active_window.__dict__["_appName"]
- )
- if hasattr(active_window, "title"):
- app_info += "\n" + "Active Window Title: " + active_window.title
- elif "_winTitle" in active_window.__dict__:
- app_info += (
- "\n"
- + "Active Window Title:"
- + active_window.__dict__["_winTitle"]
- )
- if app_info != "":
- print(
- "\n\n# Important Information:\n"
- + app_info
- + "\n(If you need to be in another active application to help the user, you need to switch to it.)"
- )
- except:
- # Non blocking
- pass
- }}
- {'role': 'user', 'type': 'message', 'content': 'podes decirme cuantos mensajes sin leer tengo en el whatsap que esta minimizado en mi pantalla?'}
- {'role': 'assistant', 'type': 'message', 'content': "Let's see if we can figure this out.\n\nFirst, I'll try to bring the minimized WhatsApp window into focus.\n\n\n\n"}
- {'role': 'assistant', 'type': 'code', 'format': 'python', 'content': '\nimport computer\n\n# Focus on the WhatsApp window\ncomputer.display.view()\ncomputer.mouse.move("WhatsApp")\ncomputer.mouse.click()\n\n# Count the number of unread messages\ncount = computer.clipboard.view().count(": )")\nprint(f"You have {count} unread messages in WhatsApp")\n'}
- {'role': 'computer', 'type': 'console', 'format': 'output', 'content': 'Output truncated. Showing the last 2800 characters.\n\n)\n 285 \'timeout\': timeout,\n 286 }\n--> 288 run_tesseract(**kwargs)\n 289 filename = f"{kwargs[\'output_filename_base\']}{extsep}{extension}"\n\nFile ~\\anaconda3\\envs\\oi\\Lib\\site-packages\\pytesseract\\pytesseract.py:260, in run_tesseract(inpu...ext in order to use the mouse, please make sure you\'ve installed `pytesseract` along with the Tesseract executable (see this Stack Overflow answer for help installing Tesseract: https://stackoverflow.com/questions/50951955/pytesseract-tesseractnotfound-error-tesseract-is-not-installed-or-its-not-i).'}
- {'role': 'assistant', 'type': 'message', 'content': "It looks like there was an error in the code. I believe it's because Tesseract is not installed or not in the PATH. \n\nBefore we can continue, we need to install and configure Tesseract. \n\nLet me help you with that!\n\nLet's try to install Tesseract and configure it. \n\n"}
- {'role': 'assistant', 'type': 'code', 'format': 'python', 'content': '\n!pip install pytesseract\n!pip install Pillow\n!pip install opencv-\n\nimport pytesseract\nimport pillow\nimport cv2\n\nprint("Tesseract installed!")\n'}
- {'role': 'computer', 'type': 'console', 'format': 'output', 'content': ''}
- {'role': 'computer', 'type': 'console', 'format': 'output', 'content': 'Requirement already satisfied: pytesseract in c:\\users\\ivan\\anaconda3\\envs\\oi\\lib\\site-packages (0.3.10)\nRequirement already satisfied: packaging>=21.3 in c:\\users\\ivan\\anaconda3\\envs\\oi\\lib\\site-packages (from pytesseract) (23.2)\nRequirement already satisfied: Pillow>=8.0.0 in c:\\users\\ivan\\anacond...ModuleNotFoundError Traceback (most recent call last)\nCell In[20], line 5\n 3 get_ipython().system(\'pip install opencv-\')\n 4 import pytesseract\n----> 5 import pillow\n 6 import cv2\n 7 print("Tesseract installed!")\n\nModuleNotFoundError: No module named \'pillow\''}
- {'role': 'assistant', 'type': 'message', 'content': "It looks like we missed installing Pillow!\n\nLet's fix this. We'll install Pillow and then import it correctly. \n\nHere's the updated code:\n\n"}
- {'role': 'assistant', 'type': 'code', 'format': 'python', 'content': '\n\n!pip install Pillow\n\nimport pytesseract\nimport pillow\nimport cv2\nprint("Tesseract installed!")\n'}
- {'role': 'computer', 'type': 'console', 'format': 'output', 'content': ''}
- {'role': 'computer', 'type': 'console', 'format': 'output', 'content': 'Requirement already satisfied: Pillow in c:\\users\\ivan\\anaconda3\\envs\\oi\\lib\\site-packages (10.2.0)\n---------------------------------------------------------------------------\nModuleNotFoundError Traceback (most recent call last)\nCell In[26], line 3\n 1 get_ipython().system(\'pip install Pillow\')\n 2 import pytesseract\n----> 3 import pillow\n 4 import cv2\n 5 print("Tesseract installed!")\n\nModuleNotFoundError: No module named \'pillow\''}
- {'role': 'assistant', 'type': 'message', 'content': "Let's try to import Pillow correctly. \n\nHere's the updated code:\n\n"}
- {'role': 'assistant', 'type': 'code', 'format': 'python', 'content': '\nfrom PIL import Image\n\nprint("Pillow imported!")\n\n'}
- {'role': 'computer', 'type': 'console', 'format': 'output', 'content': 'Pillow imported!\n'}
- {'role': 'assistant', 'type': 'message', 'content': "You're back to the original goal!\n\nLet's get back to the task at hand. \n\nTo find out how many unread messages you have in WhatsApp, we need to get the number of messages in the WhatsApp chat and then count the ones that are unchecked.\n\nHere's the updated code:\n"}
- {'role': 'assistant', 'type': 'code', 'format': 'python', 'content': '\n\nimport computer\n\n# Focus on the WhatsApp window\ncomputer.display.view()\ncomputer.mouse.move("WhatsApp")\ncomputer.mouse.click()\n\n# Count the number of unread messages\ncount = computer.clipboard.view().count(":))")\nprint(f"You have {count} unread messages in WhatsApp")\n'}
- {'role': 'computer', 'type': 'console', 'format': 'output', 'content': 'Output truncated. Showing the last 2800 characters.\n\n)\n 285 \'timeout\': timeout,\n 286 }\n--> 288 run_tesseract(**kwargs)\n 289 filename = f"{kwargs[\'output_filename_base\']}{extsep}{extension}"\n\nFile ~\\anaconda3\\envs\\oi\\Lib\\site-packages\\pytesseract\\pytesseract.py:260, in run_tesseract(inpu...ext in order to use the mouse, please make sure you\'ve installed `pytesseract` along with the Tesseract executable (see this Stack Overflow answer for help installing Tesseract: https://stackoverflow.com/questions/50951955/pytesseract-tesseractnotfound-error-tesseract-is-not-installed-or-its-not-i).'}
- {'role': 'assistant', 'type': 'message', 'content': "It looks like we have an issue with installation!\n\nLet's try installingpytesseract correctly.\n\nHere's the updated code:\n\n"}
- {'role': 'assistant', 'type': 'code', 'format': 'python', 'content': '\n!pip install pytesseract\n!pip install pillow\nimport pytesseract\nfrom PIL import Image\nimport cv2\n\n# Rest of the code...\n'}
- {'role': 'computer', 'type': 'console', 'format': 'output', 'content': ''}
- {'role': 'computer', 'type': 'console', 'format': 'output', 'content': 'Requirement already satisfied: pytesseract in c:\\users\\ivan\\anaconda3\\envs\\oi\\lib\\site-packages (0.3.10)\nRequirement already satisfied: packaging>=21.3 in c:\\users\\ivan\\anaconda3\\envs\\oi\\lib\\site-packages (from pytesseract) (23.2)\nRequirement already satisfied: Pillow>=8.0.0 in c:\\users\\ivan\\anaconda3\\envs\\oi\\lib\\site-packages (from pytesseract) (10.2.0)\nRequirement already satisfied: pillow in c:\\users\\ivan\\anaconda3\\envs\\oi\\lib\\site-packages (10.2.0)\n'}
- {'role': 'assistant', 'type': 'message', 'content': "It looks like we're all set!\n\nLet's run the code again and see what happens.\n\nHere's the updated code:\n\n"}
- {'role': 'assistant', 'type': 'code', 'format': 'python', 'content': '\nimport pytesseract\nfrom PIL import Image\nimport cv2\nimport computer\n\n# Focus on the WhatsApp window\ncomputer.mouse.move("WhatsApp")\ncomputer.mouse.click()\n\n# Count the number of unread messages\ncount = computer.clipboard.view().count(":))")\nprint(f"You have {count} unread messages in WhatsApp")\n\n'}
- {'role': 'computer', 'type': 'console', 'format': 'output', 'content': "Output truncated. Showing the last 2800 characters.\n\n\n\nFile ~\\anaconda3\\envs\\oi\\Lib\\site-packages\\pytesseract\\pytesseract.py:260, in run_tesseract(input_filename, output_filename_base, extension, lang, config, nice, timeout)\n 259 else:\n--> 260 raise TesseractNotFoundError()\n 262 wi...ext in order to use the mouse, please make sure you've installed `pytesseract` along with the Tesseract executable (see this Stack Overflow answer for help installing Tesseract: https://stackoverflow.com/questions/50951955/pytesseract-tesseractnotfound-error-tesseract-is-not-installed-or-its-not-i)."}
- {'role': 'assistant', 'type': 'message', 'content': "It seems like we've hit a roadblock!\n\nLet's try to install Tesseract and see if that solves the issue. Remember to follow the link provided in the error message for help installing Tesseract.\n\nHere's the updated code:\n\n"}
- {'role': 'assistant', 'type': 'code', 'format': 'python', 'content': '\n!pip install tesseract-ocr\n\n'}
- {'role': 'computer', 'type': 'console', 'format': 'output', 'content': ''}
- {'role': 'computer', 'type': 'console', 'format': 'output', 'content': "Output truncated. Showing the last 2800 characters.\n\nor: subprocess-exited-with-error\n \n python setup.py bdist_wheel did not run successfully.\n exit code: 1\n \n [29 lines of output]\n C:\\Users\\ivan\\anaconda3\\envs\\oi\\Lib\\site-packages\\setuptools\\dist.py:498: SetuptoolsDeprecationWarning: Invalid ...4\\\\cl.exe' failed with exit code 2\n [end of output]\n \n note: This error originates from a subprocess, and is likely not a problem with pip.\n ERROR: Failed building wheel for tesseract-ocr\nERROR: Could not build wheels for tesseract-ocr, which is required to install pyproject.toml-based projects\n"}
- {'role': 'assistant', 'type': 'message', 'content': "It looks like we've encountered an error when trying to install Tesseract-OCR. It seems like there was a problem building the wheel for the Tesseract-OCR package.\n\nDon't worry! We can try to troubleshoot this issue further. Let's first check if the package is already installed:\n\n\n\n"}
- {'role': 'assistant', 'type': 'code', 'format': 'python', 'content': '\nimport os\nimport platform\n\n# Check if Tesseract-OCR is installed\nif not os.path.exists(os.path.join(os.environ[\'USERPROFILE\'], \'Anaconda3\', \'envs\', \'oi\', \'Lib\', \'site-packages\', \'pytesseract\')):\n print("Tesseract-OCR is not installed.")\n # Try to install Tesseract-OCR\n try:\n !pip in...r(e)}")\n # Check if installation was successful\n if not os.path.exists(os.path.join(os.environ[\'USERPROFILE\'], \'Anaconda3\', \'envs\', \'oi\', \'Lib\', \'site-packages\', \'pytesseract\')):\n print("Failed to install Tesseract-OCR.")\n else:\n print("Tesseract-OCR installed successfully.")\n'}
- {'role': 'computer', 'type': 'console', 'format': 'output', 'content': ''}
- {'role': 'assistant', 'type': 'message', 'content': "Let's summarize what's happening on-screen.\n\n"}
- {'role': 'assistant', 'type': 'code', 'format': 'python', 'content': '\n\n# Ensure we\'re in the right window\ncomputer.switch_desktop()\n\n# Search Google for "Tesseract OCR"\ncomputer.browser.search("Tesseract OCR")\n\n# Wait for a few seconds to load the results\nimport time\ntime.sleep(5)\n\n# Take a screenshot to verify the results are correct\nimport pytesseract\nfrom PIL import ImageGrab\n\nimg = ImageGrab.grab(bbox=(0, 0, 1920, 1080))\nimg.save("screenshot.png")\n'}
- {'role': 'computer', 'type': 'console', 'format': 'output', 'content': "---------------------------------------------------------------------------\nAttributeError Traceback (most recent call last)\nCell In[77], line 4\n 2 pass\n 3 print('##active_line2##')\n----> 4 computer.switch_desktop()\n 5 print('##active_line3##')\n 6 pass\n\nAttributeError: 'Computer' object has no attribute 'switch_desktop'"}
- {'role': 'assistant', 'type': 'message', 'content': "Let's try to switch to a new active window.\n\nHere's a Python code that switches to the new active window:\n\n"}
- {'role': 'assistant', 'type': 'code', 'format': 'python', 'content': '\nimport computer\n\ncomputer.keyboard.write("winkey+a") # Simulate pressing the Win key and \'a\' key together to activate the application menu\n'}
- {'role': 'computer', 'type': 'console', 'format': 'output', 'content': ''}
- Traceback (most recent call last):
- File "<frozen runpy>", line 198, in _run_module_as_main
- File "<frozen runpy>", line 88, in _run_code
- File "C:\Users\ivan\anaconda3\envs\oi\Scripts\interpreter.exe\__main__.py", line 7, in <module>
- File "C:\Users\ivan\anaconda3\envs\oi\Lib\site-packages\interpreter\terminal_interface\start_terminal_interface.py", line 437, in main
- start_terminal_interface(interpreter)
- File "C:\Users\ivan\anaconda3\envs\oi\Lib\site-packages\interpreter\terminal_interface\start_terminal_interface.py", line 415, in start_terminal_interface
- interpreter.chat()
- File "C:\Users\ivan\anaconda3\envs\oi\Lib\site-packages\interpreter\core\core.py", line 167, in chat
- for _ in self._streaming_chat(message=message, display=display):
- File "C:\Users\ivan\anaconda3\envs\oi\Lib\site-packages\interpreter\core\core.py", line 196, in _streaming_chat
- yield from terminal_interface(self, message)
- File "C:\Users\ivan\anaconda3\envs\oi\Lib\site-packages\interpreter\terminal_interface\terminal_interface.py", line 151, in terminal_interface
- and "failsafeexception" in chunk["content"].lower()
- ~~~~~^^^^^^^^^^^
- KeyError: 'content'
- [IPKernelApp] WARNING | Parent appears to have exited, shutting down.
- [IPKernelApp] WARNING | Parent appears to have exited, shutting down.
Add Comment
Please, Sign In to add comment