import glob
from PIL import Image
Enter code here
image_paths=glob.glob('test_data/test/'+"*.jpg")
image_paths = [ image_paths ]
for in image_paths:
img=Image.open(i)
AttributeError Traceback (most recent call last)
File/opt/anaconda3/lib/python3.9/site-packages/PIL/Image.py:2957, in open (fp, mode, formats)
2956try:
->2957fp.seek(0)
2958 except (AttributeError,io.UnsupportedOperation):
AttributeError: 'list' object has no attribute' seek'
During handling of the above exception, another exception occurred:
AttributeError Traceback (most recent call last)
Input In[28], in<cellline:1>()
1 for in image_paths:
---->2img=Image.open(i)
File/opt/anaconda3/lib/python3.9/site-packages/PIL/Image.py:2959, in open (fp, mode, formats)
2957fp.seek(0)
2958 except (AttributeError,io.UnsupportedOperation):
->2959fp=io.BytesIO(fp.read())
2960 exclusive_fp = True
2962 prefix = fp.read(16)
AttributeError: 'list' object has no attribute 'read'
Removing the image_paths=[image_paths]
line will continue to change the behavior.
image_paths=glob.glob('test_data/test/'+"*.jpg')
results in a list, so image_paths=[image_paths]
may result in a list of image_paths
contents.
The source code provided does not mention the action to be displayed, so it may just end over time.
© 2025 OneMinuteCode. All rights reserved.