UnboundLocalError: local variable 'res' referenced before assignment
UnboundLocalError Traceback (most recent call last)
2 frames /usr/local/lib/python3.10/dist-packages/markitdown/_markitdown.py in _convert(self, local_path, extensions, **kwargs) 1043 error_trace = ("\n\n" + traceback.format_exc()).strip() 1044 -> 1045 if res is not None: 1046 # Normalize the content 1047 res.text_content = "\n".join(
UnboundLocalError: local variable 'res' referenced before assignment
`# If we hit an error log it and keep trying try: res = converter.convert(local_path, **_kwargs) except Exception: error_trace = ("\n\n" + traceback.format_exc()).strip()
if res is not None:
# Normalize the content
res.text_content = "\n".join(
[line.rstrip() for line in re.split(r"\r?\n", res.text_content)]
)
res.text_content = re.sub(r"\n{3,}", "\n\n", res.text_content)
# Todo
return res`
maybe here should some fix
I'm also experiencing this error not on every pdf but just on some of them, and it doesn't finish the conversion to md file
@aylitat I'm getting the same error above.
I have a FastAPI application utilizing markitdown through the MarkItDown API. My endpoint receives a pdf file and should be processed by markitdown. Not sure where the exact problem really lies
same as #40