Hangs on Windows if exiftool.exe is in C:\Windows\system32 (upstream PH ExifTool issue)
Closed this issue · 6 comments
Thank you for providing this package!
I've installed exiftool.exe
into C:\Windows\system32
. The following example then hangs:
import exiftool
with exiftool.ExifToolHelper() as et:
metadata = et.get_metadata("some\image.png")
The problem is that this while loop in _read_fd_endswith
does not terminate because output
actually does not change:
while not output[-endswith_count:].strip().endswith(b_endswith):
if constants.PLATFORM_WINDOWS:
# windows does not support select() for anything except sockets
# https://docs.python.org/3.7/library/select.html
output += os.read(fd, block_size)
This might be happening because to access exiftool.exe
in system32
one requires Admin rights? I'm not sure if this is a bug, and the workaround is pretty easy: just use ExifToolHelper(executable="path\\to\\exiftool.exe")
with a path the current user has access to. If it's not a bug (or something that's not easily fixable), it might be good to note it in the documentation?
Hmm that is way interesting.
I don't think it's caused by exiftool.exe
in system32
though I'd have to test that specifically. Running a process in system32
doesn't require admin rights... (i.e. You can run C:\Windows\System32\notepad.exe
all day as a user). And as long as you can run it directly, it's fine.
Can you drop into the command prompt and type where exiftool
and paste the output?
There may be something else amiss...
I wouldn't discount that that _read_fd_endswith
could have a bug... but if it's blocking there, you might have an "exiftool.exe" which is not actually exiftool somewhere on your path.
what version of exiftool are you running for that matter
exiftool -ver
where exiftool
returns C:\Windows\System32\exiftool.exe
.
Interesting enough exiftool -ver
does not return anything. In fact no matter what I try, the command does not return anything. That might explain why _read_fd_endswith
does not terminate? If I run exiftool -ver
with the executable that is not in System32
I get 12.40
. That executable is in my Downloads folder and an exact copy of the one in System32
(i.e., checksums match).
if you're getting different behavior with the executable in system32 than in your downloads... this might be an upstream bug.
So if you run your C:\Windows\System32\exiftool.exe -ver
you get nothing? ...
Yes, exactly. So I guess I should rather report this to the Exiftool author?
Yes, exactly. So I guess I should rather report this to the Exiftool author?
Yeah, unfortunately this is going to be an exiftool bug report... or at least a discussion over there. ExifTool Forums.
I recall reading about the Windows exiftool.exe having some quirks, Oliver Betz has an alternate Windows installer and they discuss problems with standard Portable Perl Applications on Windows
Btw, is there a specific reason to install your executable into the system32 directory? I don't think I've ever found a good reason to muck in any of the Windows directories...
Okay thanks!
No specific reason why I dropped it into system32, other than that I knew that this location was on the path and it's where I usually drop DLLs if they can't be found by other programs.