Sorry. The upgrade was sucessful.
What do I do next?
Sorry. The upgrade was sucessful.
What do I do next?
Try running your script.
Traceback (most recent call last):
File "/home/andy/Python/png2jpg.py", line 15, in <module>
from PIL import Image
ModuleNotFoundError: No module named 'PIL'
Ok, that's strange. Try specifying python 3.6 interpreter directly in your script:
#! /usr/bin/python3.6
Same thing occurred.
How are you running your script?
python3.10 png2jpg.py and using Geany.
This command actually says: take python3.10 interpreter and run my script. In this case the first line of your script (where you specify the python3.6 interpreter) is ignored. Python3.10 knows nothing about Pillow package, because you installed Pillow for python3.6. So try running python3.6 png2jpg.py
.
This is interesting when I ran it.
python3.6 png2jpg.py png2jpg.py
['/home/andy/Python', '/usr/lib/python36.zip', '/usr/lib/python3.6', '/usr/lib/python3.6/lib-dynload', '/home/andy/.local/lib/python3.6/site-packages', '/usr/local/lib/python3.6/dist-packages', '/usr/lib/python3/dist-packages']
Traceback (most recent call last):
File "png2jpg.py", line 21, in <module>
im = Image.open(sys.argv[1])
File "/home/andy/.local/lib/python3.6/site-packages/PIL/Image.py", line 3031, in open
"cannot identify image file %r" % (filename if filename else fp)
PIL.UnidentifiedImageError: cannot identify image file 'png2jpg.py'
I believe you have a typo here. Your script expects an image file as an argument.
You are right.
I commented this out and it now works.
print (sys.path)
Thanks so very much.
You are welcome Andy!