markitdown icon indicating copy to clipboard operation
markitdown copied to clipboard

when convert a pdf file error

Open FreeGodCode opened this issue 9 months ago • 2 comments

File ~/miniconda3/lib/python3.12/site-packages/markitdown/_markitdown.py:1719, in MarkItDown._convert(self, local_path, extensions, **kwargs) 1716 except Exception: 1717 error_trace = ("\n\n" + traceback.format_exc()).strip() -> 1719 if res is not None: 1720 # Normalize the content 1721 res.text_content = "\n".join( 1722 [line.rstrip() for line in re.split(r"\r?\n", res.text_content)] 1723 ) 1724 res.text_content = re.sub(r"\n{3,}", "\n\n", res.text_content)

UnboundLocalError: cannot access local variable 'res' where it is not associated with a value

FreeGodCode avatar Mar 19 '25 07:03 FreeGodCode

You seem to be using an old version of the package. This was fixed in d0ed74fdf4708e9931d8bc4dc5c711b1e9d444fe.

0xmohit avatar Mar 19 '25 15:03 0xmohit

Yes, please grab the latest, and let me know if it's still an issue.

afourney avatar Mar 19 '25 17:03 afourney