Fix exiftool in well-known paths. (#1106)

This commit is contained in:
afourney
2025-03-07 21:47:20 -08:00
committed by GitHub
parent 515fa854bf
commit 99d8e562db
3 changed files with 27 additions and 30 deletions

View File

@@ -5,26 +5,16 @@ import sys
import shutil
import os
import warnings
from typing import BinaryIO, Optional, Any
from typing import BinaryIO, Any, Union
def exiftool_metadata(
file_stream: BinaryIO, *, exiftool_path: Optional[str] = None
file_stream: BinaryIO,
*,
exiftool_path: Union[str, None],
) -> Any: # Need a better type for json data
# Check if we have a valid pointer to exiftool
# Nothing to do
if not exiftool_path:
which_exiftool = shutil.which("exiftool")
if which_exiftool:
warnings.warn(
f"""Implicit discovery of 'exiftool' is disabled. If you would like to continue to use exiftool in MarkItDown, please set the exiftool_path parameter in the MarkItDown consructor. E.g.,
md = MarkItDown(exiftool_path="{which_exiftool}")
This warning will be removed in future releases.
""",
DeprecationWarning,
)
# Nothing to do
return {}
# Run exiftool