Error in "concatenate_markdown_pages" example in Usage tutorial for PPStructureV3: TypeError: write() argument must be str, not MarkdownResult
Search before asking
- I have searched the PaddleOCR Docs and found no similar bug report.
- I have searched the PaddleOCR Issues and found no similar bug report.
- I have searched the PaddleOCR Discussions and found no similar bug report.
Bug (问题描述)
In "concatenate_markdown_pages" example in Usage tutorial for PPStructureV3 it says: "If you want to convert the entire PDF to a single Markdown file, use the following method:"
...
markdown_texts = pipeline.concatenate_markdown_pages(markdown_list)
...
with open(mkd_file_path, "w", encoding="utf-8") as f:
f.write(markdown_texts)
...
The above code is incorrect and gives error:
TypeError: write() argument must be str, not MarkdownResult.
markdown_texts has type class 'paddlex.inference.pipelines.pp_doctranslation.result.MarkdownResult', which f.write() cannot accept as a parameter.
How to convert paddlex.inference.pipelines.pp_doctranslation.result.MarkdownResult to string?
♂️ Environment (运行环境)
This issue is about incorrect sample code in documentation, and is software and HW independent.
Minimal Reproducible Example (最小可复现问题的Demo)
This example can be found at https://www.paddleocr.ai/latest/en/version3.x/pipeline_usage/PP-StructureV3.html#22-python-script-integration
Source: PaddlePaddle/PaddleOCR