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

Error taking a screenshot on macos

Open movinimage opened this issue 1 year ago • 1 comments

Describe the bug

When use "interpreter --os" on an m1 macos 14.2. Any time it tries to take a screenshot I get an error. As follows:

Let's try using a direct call to view the display

without additional imports or delays
computer.display.view()



TypeError Traceback
(most recent call last)
Cell In[7], line 4
2 pass
3 print('##active_line2##')
----> 4 computer.display.view()

File
/opt/homebrew/lib/python3.11/site-packages/interpret
er/core/computer/display/display.py:52, in
Display.view(self, show, quadrant)
48 def view(self, show=True, quadrant=None):
49 """
50 Redirects to self.screenshot
51 """
---> 52 return self.screenshot(show, quadrant)

File
/opt/homebrew/lib/python3.11/site-packages/interpret
er/core/computer/display/display.py:81, in
Display.screenshot(self, show, quadrant,
active_app_only)
79 screenshot =
pyautogui.screenshot(region=region)
80 else:
---> 81 screenshot = pyautogui.screenshot()
82 # message =
format_to_recipient("Taking a screenshot of the
entire screen. This is not recommended. You (the
language model assistant) will recieve it with low
resolution.\n\nTo maximize performance, use
computer.display.view(active_app_only=True). This
will produce an ultra high quality image of the
active application.", "assistant")
83 # print(message)
84
85 else:
86 screen_width, screen_height =
pyautogui.size()

File
/opt/homebrew/lib/python3.11/site-packages/pyscreeze
/init.py:527, in screenshot_osx(imageFilename,
region)
523 """
524 TODO
525 """
526 # TODO - use tmp name for this file.
--> 527 if tuple(PIL__version
_) < (6, 2, 1):
528 # Use the screencapture program if
Pillow is older than 6.2.1, which
529 # is when Pillow supported
ImageGrab.grab() on macOS. (It may have
530 # supported it earlier than 6.2.1, but I
haven't tested it.)
531 if imageFilename is None:
532 tmpFilename = 'screenshot%s.png' %
(datetime.datetime.now().strftime('%Y-%m%d_%H-%M-%S-
%f'))

TypeError: '<' not supported between instances of
'str' and 'int'

Reproduce

Use "interpreter --os" on an m1 macos 14.2. Any time it tries to take a screenshot I get an error.

Expected behavior

It should take a screenshot and recognize it to find icons, strings, etc...

Screenshots

No response

Open Interpreter version

0.2.0

Python version

3.9.6

Operating System name and version

MacOs 14.2

Additional context

No response

movinimage avatar Feb 02 '24 01:02 movinimage

I also have this issue

https://www.youtube.com/live/VIz7d_37kkI?si=FAu7DX1H8TMJi9ii&t=3275

looks like this issue: https://stackoverflow.com/questions/76361049/how-to-fix-typeerror-not-supported-between-instances-of-str-and-int-wh

i'll make a PR

aj47 avatar Jun 23 '24 03:06 aj47