Skip to content

fix: catch OSError when exiftool binary is missing (#1960)#2082

Open
doitgo wants to merge 1 commit into
microsoft:mainfrom
doitgo:fix/issue-1960
Open

fix: catch OSError when exiftool binary is missing (#1960)#2082
doitgo wants to merge 1 commit into
microsoft:mainfrom
doitgo:fix/issue-1960

Conversation

@doitgo

@doitgo doitgo commented Jun 6, 2026

Copy link
Copy Markdown

Fixes #1960
When exiftool_path points to a binary that does not exist, the subprocess.run calls raised FileNotFoundError, which propagated unhandled through exiftool_metadata() and crashed the whole conversion.

Add OSError to the except clauses at both subprocess.run sites and wrap the error in a RuntimeError that includes the path, giving users a clear, actionable error message.

Add a regression test for the missing-binary case and a sanity check that the exiftool_path=None early return still works.

When exiftool_path points to a binary that does not exist, the
subprocess.run calls raised FileNotFoundError, which propagated
unhandled through exiftool_metadata() and crashed the whole
conversion.

Add OSError to the except clauses at both subprocess.run sites
and wrap the error in a RuntimeError that includes the path,
giving users a clear, actionable error message.

Add a regression test for the missing-binary case and a sanity
check that the exiftool_path=None early return still works.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@doitgo doitgo requested a review from noezhiya-dot June 9, 2026 12:15
@doitgo

doitgo commented Jun 9, 2026

Copy link
Copy Markdown
Author

Hi @afourney,

I'd like to draw your attention to PR #2082, which fixes #1960.

Issue: when the configured exiftool path points to a binary that doesn't exist, the current code raises an unhandled FileNotFoundError that crashes the entire conversion.

Fix (+27 / -2 across 2 files):

  • src/markitdown/converters/_exiftool.py: catch OSError (parent of FileNotFoundError / PermissionError) at both subprocess.run sites and re-raise as RuntimeError with the offending path included for easier debugging.
  • tests/test_exiftool_converter.py: add a regression test for the missing-binary case and a sanity check that the exiftool_path=None early-return path still returns {}.

Local tests pass. Could you or another maintainer take a look when you have a moment? Happy to adjust the implementation, the error message wording, or the test coverage based on your feedback.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

exiftool_metadata() crashes with FileNotFoundError when exiftool_path binary doesn't exist

1 participant