[Feature Request] Option to skip files raising exceptions.
Opened this issue · 2 comments
mikidep commented
The tool (v. 1.3.5) fails on a big batch task upon encountering a single image with zero bytes file size. Wouldn't it be better for the tool to be able to log the issue and keep on converting the rest of the folder?
victordomingos commented
Seems to be an issue similar to #13. There were some commits on this repository since the latest PyPI update. It may have been solved recently. The expected behaviour is to skip the problematic files and keep going with the next, silently. No logging implemented for now, though.
Are you able to test it with the current GitHub version?
varnav commented
Current version sometimes fails for me:
concurrent.futures.process._RemoteTraceback:
"""
Traceback (most recent call last):
File "C:\Program Files\Python39\lib\concurrent\futures\process.py", line 243, in _process_worker
r = call_item.fn(*call_item.args, **call_item.kwargs)
File "C:\Program Files\Python39\lib\concurrent\futures\process.py", line 202, in _process_chunk
return [fn(*args) for args in chunk]
File "C:\Program Files\Python39\lib\concurrent\futures\process.py", line 202, in <listcomp>
return [fn(*args) for args in chunk]
File "C:\src\optimize-images\optimize_images\do_optimization.py", line 44, in do_optimization
return optimize_jpg(t)
File "C:\src\optimize-images\optimize_images\img_optimize_jpg.py", line 119, in optimize_jpg
has_exif)
UnboundLocalError: local variable 'has_exif' referenced before assignment
"""
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Program Files\Python39\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Program Files\Python39\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\src\optimize-images\optimize_images\__main__.py", line 139, in <module>
main()
File "C:\src\optimize-images\optimize_images\__main__.py", line 96, in main
for r in executor.map(do_optimization, tasks):
File "C:\Program Files\Python39\lib\concurrent\futures\process.py", line 559, in _chain_from_iterable_of_lists
for element in iterable:
File "C:\Program Files\Python39\lib\concurrent\futures\_base.py", line 600, in result_iterator
yield fs.pop().result()
File "C:\Program Files\Python39\lib\concurrent\futures\_base.py", line 433, in result
return self.__get_result()
File "C:\Program Files\Python39\lib\concurrent\futures\_base.py", line 389, in __get_result
raise self._exception
UnboundLocalError: local variable 'has_exif' referenced before assignment
Process finished with exit code 1