Closed CoinCheung closed 2 weeks ago
I have plenty of images, so I process them with multi-processing. However, when I run the script, I got the errors like
/opt/miniconda3/envs/py310/lib/python3.10/site-packages/PIL/TiffImagePlugin.py:900: UserWarning: Truncated File Read warnings.warn(str(msg))
I cannot know which image brings this warning, since it is merely warning. Would you tell me how to make this warning an error so that I can catch it?
By the way, I have already checked the start bytes and end bytes of the image files, there should not be truncated images...
You can add
import warnings warnings.filterwarnings("error")
before you run your code to treat warnings as errors.
Thanks, it works for me.
I have plenty of images, so I process them with multi-processing. However, when I run the script, I got the errors like
I cannot know which image brings this warning, since it is merely warning. Would you tell me how to make this warning an error so that I can catch it?
By the way, I have already checked the start bytes and end bytes of the image files, there should not be truncated images...