Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Option to skip files raising exceptions. #25

Open
mikidep opened this issue Jun 19, 2020 · 2 comments
Open

[Feature Request] Option to skip files raising exceptions. #25

mikidep opened this issue Jun 19, 2020 · 2 comments

Comments

@mikidep
Copy link

mikidep commented Jun 19, 2020

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
Copy link
Owner

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
Copy link
Contributor

varnav commented Nov 29, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants