Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/markitdown/src/markitdown/_markitdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def convert(
return self.convert_stream(source, stream_info=stream_info, **kwargs)
else:
raise TypeError(
f"Invalid source type: {type(source)}. Expected str, requests.Response, BinaryIO."
f"Invalid source type: {type(source)}. Expected str, pathlib.Path, requests.Response, or BinaryIO."
)

def convert_local(
Expand Down
13 changes: 13 additions & 0 deletions packages/markitdown/tests/test_module_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,19 @@ def test_exceptions() -> None:
assert type(exc_info.value.attempts[0].converter).__name__ == "PptxConverter"


def test_invalid_source_type_error_lists_supported_types() -> None:
markitdown = MarkItDown()

with pytest.raises(TypeError) as exc_info:
markitdown.convert(None)

message = str(exc_info.value)
assert "str" in message
assert "pathlib.Path" in message
assert "requests.Response" in message
assert "BinaryIO" in message


@pytest.mark.skipif(
skip_exiftool,
reason="do not run if exiftool is not installed",
Expand Down