Fix UnboundLocalError in MarkItDown._convert (#1038)
Initialize `res` at the beginning of `_convert`. If the first converter raises an exception, then the `res` variable was not initialized and we got an error when checking `if res is not None`
This commit is contained in:
@@ -312,6 +312,7 @@ class MarkItDown:
|
|||||||
def _convert(
|
def _convert(
|
||||||
self, local_path: str, extensions: List[Union[str, None]], **kwargs
|
self, local_path: str, extensions: List[Union[str, None]], **kwargs
|
||||||
) -> DocumentConverterResult:
|
) -> DocumentConverterResult:
|
||||||
|
res: Union[None, DocumentConverterResult] = None
|
||||||
error_trace = ""
|
error_trace = ""
|
||||||
|
|
||||||
# Create a copy of the page_converters list, sorted by priority.
|
# Create a copy of the page_converters list, sorted by priority.
|
||||||
|
|||||||
Reference in New Issue
Block a user