sylikc/pyexiftool

execute hangs in Windows

Closed this issue · 3 comments

baloe commented

I am unable to use the execute function (get_metadata works flawlessly). My code is basically

import exiftool
with exiftool.ExifToolHelper() as et:
   params = ['-TagsFromFile D:\\somepath\\ND800_0007854.NEF.xmp', '-XMP:Subject', '-XMP:HierarchicalSubject', 'D:\\somepath\\ND800_0007854.jpg']
   et.execute(*params)

and it hangs in the execute function until I kill it. The traceback points at

  File "C:\ProgramData\Miniconda3\envs\phototools\lib\site-packages\exiftool\exiftool.py", line 135, in _read_fd_endswith
    while not _get_buffer_end(output_list, endswith_count).strip().endswith(b_endswith):

I am able to run the command in the terminal:

exiftool -TagsFromFile D:\somepath\ND800_0007854.NEF.xmp -XMP:Subject -XMP:HierarchicalSubject D:\somepath\ND800_0007854.jpg
Warning: [minor] Ignored empty rdf:Seq list for darktable:masks_history - D:/somepath/ND800_0007854.jpg
    1 image files updated
baloe commented

Never mind, I had a bug in my code. The correct version runs fine:

import exiftool
with exiftool.ExifToolHelper() as et:
   params = ['-TagsFromFile', 'D:\\somepath\\ND800_0007854.NEF.xmp', '-XMP:Subject', '-XMP:HierarchicalSubject', 'D:\\somepath\\ND800_0007854.jpg']
   et.execute(*params)

That's actually odd that it hangs on execute(). In theory the code should never block, even if there is an error in the command line syntax.

Could you tell me what version of exiftool you're using?

Might be worth investigating further if it like hangs entirely.

baloe commented

exiftool version: 12.54 (that's the Windows binary currently distributed on the official website)

The python is conda-based, with all packages (except pyexiftool) installed from the conda-forge channel, including:

# Name                    Version                   Build  Channel
pyexiftool                0.5.5                    pypi_0    pypi
python                    3.10.8          h4de0772_0_cpython    conda-forge