Skip to content

Commit b05cba8

Browse files
committed
AS-171 tests action,15
1 parent 9899de6 commit b05cba8

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/openparse/processing/markitdown_doc_parser.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,24 @@
22
from datetime import date
33
import logging
44
from pathlib import Path
5-
from markitdown import MarkItDown
5+
66
from openparse.schemas import Node, TextElement, Bbox, FileMetadata, NodeVariant
77

8+
try:
9+
from markitdown.markitdown import MarkItDown
10+
except ImportError:
11+
try:
12+
from markitdown import MarkItDown
13+
except ImportError:
14+
# Create a stub class for testing
15+
class MarkItDown:
16+
"""Stub class for when markitdown is not available"""
17+
def __init__(self, *args, **kwargs):
18+
raise ImportError(
19+
"markitdown package is not properly installed. "
20+
"Please install it with `pip install markitdown`"
21+
)
22+
823
class DocumentParser:
924
"""Parser using Microsoft's MarkItDown for multiple file formats."""
1025

0 commit comments

Comments
 (0)