The photos do not load into the chunk because you made a mistake in your filter condition.
("JPG" or "JPEG" or "TIF" or "PNG") in photo
does not check for the presence of the extension (I assume) in the given photo path but actually does (True or True or True or True) in photo
or True in photo
In this type of situation (again, assuming you check the extension) it is easier to use the endswith() str method that can take a tuple:
# Be careful to check for lower extensions when you lower the path
path.lower().endswith(("jpg", "jpeg", "tif", "png"))
Then, as addPhotos() takes a list of file paths, you can simply filter the result of os.listdir():
# Only keep files with extension jpg, jpeg, tif and png
image_list = [
os.path.join(path_photos, path)
for path in os.listdir(path_photos)
if path.lower().endswith(("jpg", "jpeg", "tif", "png"))
]
chunk.addPhotos(image_list)
I reformatted your script in the attached file (haven't tested it though). Don't forget that indentation is very important in Python.