make preloader throw if file is corrupt
This commit is contained in:
parent
2b447f3f0c
commit
4eac671544
|
@ -69,7 +69,14 @@ class DataLoaderMultiAspect():
|
||||||
|
|
||||||
#if debug_level > 1: print(f" * DLMA file: {pathname} with caption: {caption}")
|
#if debug_level > 1: print(f" * DLMA file: {pathname} with caption: {caption}")
|
||||||
|
|
||||||
image = Image.open(pathname)
|
try:
|
||||||
|
image = Image.open(pathname).convert('RGB')
|
||||||
|
except Exception as e:
|
||||||
|
print(f"File corrupt. Cannot continue. Error opening image: {self.pathname}")
|
||||||
|
print(e)
|
||||||
|
print(f"You should remove this image or try to correct it by resaving it.")
|
||||||
|
exit()
|
||||||
|
|
||||||
width, height = image.size
|
width, height = image.size
|
||||||
image_aspect = width / height
|
image_aspect = width / height
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue