Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSError: cannot write mode P as JPEG #9

Open
SteveMemeulass opened this issue May 8, 2023 · 0 comments
Open

OSError: cannot write mode P as JPEG #9

SteveMemeulass opened this issue May 8, 2023 · 0 comments

Comments

@SteveMemeulass
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant