Skip to content

Commit 8ca266c

Browse files
author
SparkLabScout
committed
fix: initialize res to None to prevent UnboundLocalError
Fixes issue #81 - UnboundLocalError when no converter accepts the file. The variable res was only set inside the 'if _accepts:' block, but was checked later outside of it. When no converter accepts the file, res would be undefined, causing UnboundLocalError.
1 parent 0b27f28 commit 8ca266c

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

packages/markitdown/src/markitdown/_markitdown.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,7 @@ def _convert(
590590

591591
# Check if the converter will accept the file, and if so, try to convert it
592592
_accepts = False
593+
res = None
593594
try:
594595
_accepts = converter.accepts(file_stream, stream_info, **_kwargs)
595596
except NotImplementedError:

0 commit comments

Comments
 (0)