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

OSError: cannot write mode RGBA as JPEG

Open victoriano opened this issue 1 year ago • 3 comments

Describe the bug

CleanShot 2024-01-06 at 20 17 51@2x

I get this error when trying to run interpreter in --os mode.

Reproduce


KeyError Traceback (most recent call last) File ~/miniconda3/lib/python3.10/site-packages/PIL/JpegImagePlugin.py:639, in _save(im, fp, filename) 638 try: --> 639 rawmode = RAWMODE 640 except KeyError as e:

KeyError: 'RGBA'

The above exception was the direct cause of the following exception:

OSError Traceback (most recent call last) File ~/miniconda3/lib/python3.10/site-packages/PIL/Image.py:643, in Image._repr_image(self, image_format, **kwargs) 642 try: --> 643 self.save(b, image_format, **kwargs) 644 except Exception as e:

File ~/miniconda3/lib/python3.10/site-packages/PIL/Image.py:2413, in Image.save(self, fp, format, **params) 2412 try: -> 2413 save_handler(self, fp, filename) 2414 except Exception:

File ~/miniconda3/lib/python3.10/site-packages/PIL/JpegImagePlugin.py:642, in _save(im, fp, filename) 641 msg = f"cannot write mode {im.mode} as JPEG" --> 642 raise OSError(msg) from e 644 info = im.encoderinfo

OSError: cannot write mode RGBA as JPEG

The above exception was the direct cause of the following exception:

ValueError Traceback (most recent call last) File ~/miniconda3/lib/python3.10/site-packages/IPython/core/formatters.py:344, in

Expected behavior

expecting to be able to continue sending correctly the image of the screen

Screenshots

No response

Open Interpreter version

0.2.0

Python version

3.10.9

Operating System name and version

MacOS Sonoma 14.2.1

Additional context

No response

victoriano avatar Jan 06 '24 19:01 victoriano

I encountered a similar problem during my data visualization-intensive days. I'm not certain about all the details, but when IPython is active in interactive mode (as in this case), any image or plot that is rendered, regardless of when it's created (even without using show()/display()), is captured and displayed in the REPL. This feature was designed to facilitate use in interactive notebooks like Jupyter.

However, it can sometimes cause issues, such as in this case where RGBA (with an alpha channel) is not functioning properly. I believe this issue occurs on MacOS only but not sure.

double-thinker avatar Jan 08 '24 04:01 double-thinker

Can you try it @victoriano ?

pip install git+https://github.com/double-thinker/open-interpreter.git@fix/rgba_problem

Let me know if this helps :)

double-thinker avatar Jan 08 '24 04:01 double-thinker

it worked! thanks!

victoriano avatar Jan 08 '24 23:01 victoriano