From e4b419ba4099ed5463627ab58a99e025780d20eb Mon Sep 17 00:00:00 2001 From: afourney Date: Thu, 27 Feb 2025 23:09:33 -0800 Subject: [PATCH 1/2] Pin Markdownify version. (#1069) * Pin markdownify version. TODO: update code for compatibility with Markdownify 1.0.0 --- packages/markitdown/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/markitdown/pyproject.toml b/packages/markitdown/pyproject.toml index 2a4e203..a321fee 100644 --- a/packages/markitdown/pyproject.toml +++ b/packages/markitdown/pyproject.toml @@ -27,7 +27,7 @@ dependencies = [ "beautifulsoup4", "requests", "mammoth", - "markdownify", + "markdownify~=0.14.1", "numpy", "python-pptx", "pandas", From d0ed74fdf4708e9931d8bc4dc5c711b1e9d444fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menezes?= <77670471+menezesandre@users.noreply.github.com> Date: Fri, 28 Feb 2025 07:11:27 +0000 Subject: [PATCH 2/2] 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` --- packages/markitdown/src/markitdown/_markitdown.py | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/markitdown/src/markitdown/_markitdown.py b/packages/markitdown/src/markitdown/_markitdown.py index 297f554..7c8d006 100644 --- a/packages/markitdown/src/markitdown/_markitdown.py +++ b/packages/markitdown/src/markitdown/_markitdown.py @@ -312,6 +312,7 @@ class MarkItDown: def _convert( self, local_path: str, extensions: List[Union[str, None]], **kwargs ) -> DocumentConverterResult: + res: Union[None, DocumentConverterResult] = None error_trace = "" # Create a copy of the page_converters list, sorted by priority.