It seems to me, anyway.
if os.path.realpath(source) == os.path.realpath(output) and source != '-':
with tempfile.TemporaryDirectory('tifftools') as tmpdir:
output = os.path.join(tmpdir, 'output.tiff')
_tiff_set(source, output, setlist, unset, setfrom, **kwargs)
with open(source, 'r+b') as fdest, open(output, 'rb') as fsrc:
fdest.truncate(0)
shutil.copyfileobj(fsrc, fdest)
It seems to me, anyway.
from
commands.py:538 tiff_setI lost a file just now sending an interrupt during
shutil.copyfileobj. os.replace or even shutil.move are safer and more efficient alternatives.