There is nothing wrong with code,but when try to load image from temp location it fail.
Try to do all in interactive shell or all as code
Quick test both work.
Try to do all in interactive shell or all as code
.py
,now it look like you run to first line outside of shell.Quick test both work.
(sc_env) tom@tom-VirtualBox:~/sc_env$ python Python 3.10.2 (main, Jan 31 2022, 15:25:53) [GCC 7.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> from PIL import Image, ImageOps >>> >>> image = '/home/tom/sc_env/images_icons_linux-bsd.gif' >>> im = Image.open(image) >>> im <PIL.GifImagePlugin.GifImageFile image mode=P size=32x32 at 0x7F3FE666D630> >>> im.show()As code.
# im_test.py from PIL import Image, ImageOps image = '/home/tom/sc_env/images_icons_linux-bsd.gif' im = Image.open(image) im.show()
Output:(sc_env) tom@tom-VirtualBox:~/sc_env$ python im_test.py
(sc_env) tom@tom-VirtualBox:~/sc_env$ # show the image