markitdown icon indicating copy to clipboard operation
markitdown copied to clipboard

hatch test fail with: The formats ['.csv'] are not supported.

Open bmerkle opened this issue 1 year ago • 4 comments

I followed the instructions https://github.com/microsoft/markitdown and installed markitdown from source. I created a venv (maybe this would be a good addition to the docs). pip install -e .

then i installed the test and checks framework https://github.com/microsoft/markitdown?tab=readme-ov-file#running-tests-and-checks

when i run the tests

(markitdown) C:\work\microsoft\markitdown>venv\Scripts\hatch.exe test
======================================================================================================= test session starts =======================================================================================================
platform win32 -- Python 3.11.9, pytest-8.3.4, pluggy-1.5.0
rootdir: C:\work\microsoft\markitdown
configfile: pyproject.toml
plugins: anyio-4.7.0, mock-3.14.0, rerunfailures-14.0, xdist-3.6.1
collected 5 items

I get the following exception:

       # If we got this far without success, report any exceptions
        if len(error_trace) > 0:
            raise FileConversionException(
                f"Could not convert '{local_path}' to Markdown. File type was recognized as {extensions}. While converting the file, the following error was encountered:\n\n{error_trace}"
            )

        # Nothing can handle it!
>       raise UnsupportedFormatException(
            f"Could not convert '{local_path}' to Markdown. The formats {extensions} are not supported."
        )
E       markitdown._markitdown.UnsupportedFormatException: Could not convert 'C:\work\microsoft\markitdown\tests\test_files\test_mskanji.csv' to Markdown. The formats ['.csv'] are not supported.

src\markitdown\_markitdown.py:1472: UnsupportedFormatException
===================================================================================================== short test summary info =====================================================================================================
FAILED tests/test_markitdown.py::test_markitdown_local - markitdown._markitdown.UnsupportedFormatException: Could not convert 'C:\work\microsoft\markitdown\tests\test_files\test_mskanji.csv' to Markdown. The formats ['.csv'] are not supported.
============================================================================================= 1 failed, 3 passed, 1 skipped in 31.75s =============================================================================================

bmerkle avatar Dec 19 '24 15:12 bmerkle

my encoding in cmd.exe is utf-8.

the problem seems to be related with the encoding of the csv files contained in the test suite

bmerkle avatar Dec 19 '24 16:12 bmerkle

Status Update — 2026-04-24

The CSV format support has been implemented. The fix was merged in commit 8576f1d (#1176):

  • CsvConverter was added to handle .csv files
  • Converter accepts both .csv extension and text/csv / application/csv MIME types
  • CSV content is converted to GitHub-flavored markdown tables
  • Encoding detection uses charset_normalizer for automatic charset detection

Additionally, there have been subsequent improvements to the CSV converter:

  • PR #1816 (open): fix(csv): escape pipes and newlines in CSV cells — properly escapes pipe characters and newlines in CSV cells when generating markdown tables, preventing column misalignment

The original error The formats ['.csv'] are not supported is now resolved. If you're still experiencing encoding issues with specific CSV files, please open a new issue with a specific reproduction.

Jah-yee avatar Apr 24 '26 09:04 Jah-yee

The CSV format support (CsvConverter) was added in commit 8576f1d (PR #1176) which merged on 2025-04-13. The test file test_mskanji.csv exists and the converter handles CSV with proper encoding detection via charset_normalizer. The original issue is therefore resolved.

Additionally, PR #1816 (fix(csv): escape pipes and newlines in CSV cells) improves CSV output quality further. This issue can be closed.

Jah-yee avatar Apr 24 '26 09:04 Jah-yee

CSV conversion is now handled by the dedicated CsvConverter introduced in #1176, including automatic encoding detection. Closing the original unsupported-format report as resolved. If test_mskanji.csv still fails on a current checkout, please ask to reopen with the updated traceback.

afourney avatar Sep 05 '26 21:09 afourney