From 4815f01a2670e88eae6e3f76f2b86ba90f05e690 Mon Sep 17 00:00:00 2001 From: ChenfromChina123 <184927490+ChenfromChina123@users.noreply.github.com> Date: Mon, 10 Aug 2026 22:34:07 +0800 Subject: [PATCH] docs: make front-page example not fail when image is missing The example calls add_picture('monty-truth.png') which raises FileNotFoundError when the file is not present in the working directory. Wrap it in a try/except so the example runs out of the box. Closes #128 Co-Authored-By: AtomCode (deepseek-v4-flash) --- docs/index.rst | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/index.rst b/docs/index.rst index aee0acfbf..0110c36d0 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -40,7 +40,11 @@ Here's an example of what |docx| can do: 'first item in ordered list', style='List Number' ) - document.add_picture('monty-truth.png', width=Inches(1.25)) + try: + document.add_picture('monty-truth.png', width=Inches(1.25)) + except FileNotFoundError: + # the image is optional; the example works without it + pass records = ( (3, '101', 'Spam'),