Replaced call to which, closes #171

This commit is contained in:
Rhet Turnbull
2020-08-09 18:09:32 -07:00
parent 7467bbf62b
commit fa149dc7e1

View File

@@ -8,6 +8,7 @@
import json import json
import logging import logging
import os import os
import shutil
import subprocess import subprocess
import sys import sys
from functools import lru_cache # pylint: disable=syntax-error from functools import lru_cache # pylint: disable=syntax-error
@@ -22,8 +23,7 @@ EXIFTOOL_STAYOPEN_EOF_LEN = len(EXIFTOOL_STAYOPEN_EOF)
@lru_cache(maxsize=1) @lru_cache(maxsize=1)
def get_exiftool_path(): def get_exiftool_path():
""" return path of exiftool, cache result """ """ return path of exiftool, cache result """
result = subprocess.run(["which", "exiftool"], stdout=subprocess.PIPE) exiftool_path = shutil.which('exiftool')
exiftool_path = result.stdout.decode("utf-8")
if _debug(): if _debug():
logging.debug("exiftool path = %s" % (exiftool_path)) logging.debug("exiftool path = %s" % (exiftool_path))
if exiftool_path: if exiftool_path: