Skip to content

OSError: cannot write mode P as JPEG #9

@SteveMemeulass

Description

@SteveMemeulass

hello guys, so everything was working fine last night, I had created one video and had an idea, since I was going to be using this script to make 2 - 4 videos per day I would have liked the data folder to be structured as follows, "/data/{date}/{time}/(images collected)"
so I went about adding this code to the RedditBot.py
I then tried to run the main.py file and came back with this error:

`Traceback (most recent call last):
File "C:\YouTube\Gain Wealth With Steve\Reddit AutoTube\env\lib\site-packages\PIL\JpegImagePlugin.py", line 629, in
_save
rawmode = RAWMODE[im.mode]
KeyError: 'P'

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

Traceback (most recent call last):
File "c:\YouTube\Gain Wealth With Steve\Reddit AutoTube\main.py", line 31, in
redditbot.save_image(post)
File "c:\YouTube\Gain Wealth With Steve\Reddit AutoTube\utils\RedditBot.py", line 73, in save_image
scale_gif(image_path, scale)
File "c:\YouTube\Gain Wealth With Steve\Reddit AutoTube\utils\Scalegif.py", line 19, in scale_gif
gif.save(path)
File "C:\YouTube\Gain Wealth With Steve\Reddit AutoTube\env\lib\site-packages\PIL\Image.py", line 2240, in save
save_handler(self, fp, filename)
File "C:\YouTube\Gain Wealth With Steve\Reddit AutoTube\env\lib\site-packages\PIL\JpegImagePlugin.py", line 631, in
_save
raise OSError(f"cannot write mode {im.mode} as JPEG") from e
OSError: cannot write mode P as JPEG`

So I quickly removed the lines of code I had just added and tried to run the Python code again and came back with the same error, so from this point, I thought I messed something else up while editing the files so I started fresh, and deleted all the files and replaced them, but I'm still getting this error. Can anyone shed any light on how I can get this working?

Thanks for taking the time to read!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions