Kilian / Trimage

A cross-platform tool for optimizing PNG and JPG files.
http://trimage.org
MIT License
706 stars 55 forks source link

FileNotFoundError: [Errno 2] No such file or directory: '/tmp/file.png' #78

Open diklimchuk opened 3 years ago

diklimchuk commented 3 years ago

In command line mode trimage fails to handle files with the same name in different directory. Sample structure:

_root one image.png two image.png

command: trimage -d root

Stacktrace:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/trimage/ThreadPool/ThreadPool.py", line 83, in execute
    return_value = self.callable(*self.arguments) #IGNORE:W0142
  File "/usr/local/lib/python3.9/site-packages/trimage/trimage.py", line 397, in compress
    remove(backupfullpath)
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/image.png'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/Cellar/python@3.9/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/threading.py", line 950, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.9/site-packages/trimage/ThreadPool/ThreadPool.py", line 124, in run
    job.execute()
  File "/usr/local/lib/python3.9/site-packages/trimage/ThreadPool/ThreadPool.py", line 86, in execute
    logger.warning("A job in the ThreadPool raised an exception: ", excep)
  File "/usr/local/Cellar/python@3.9/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/logging/__init__.py", line 1446, in warning
    self._log(WARNING, msg, args, **kwargs)
  File "/usr/local/Cellar/python@3.9/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/logging/__init__.py", line 1577, in _log
    self.handle(record)
  File "/usr/local/Cellar/python@3.9/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/logging/__init__.py", line 1587, in handle
    self.callHandlers(record)
  File "/usr/local/Cellar/python@3.9/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/logging/__init__.py", line 1648, in callHandlers
    if record.levelno >= hdlr.level:
AttributeError: '_io.TextIOWrapper' object has no attribute 'level'

Setup: Mac OS, trimage 1.0.6

fostimus commented 3 years ago

Same problem here