Skip to content

Commit 4815f01

Browse files
ChenfromChina123AtomCode (deepseek-v4-flash)
andcommitted
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) <noreply@atomgit.com>
1 parent e454546 commit 4815f01

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

docs/index.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@ Here's an example of what |docx| can do:
4040
'first item in ordered list', style='List Number'
4141
)
4242

43-
document.add_picture('monty-truth.png', width=Inches(1.25))
43+
try:
44+
document.add_picture('monty-truth.png', width=Inches(1.25))
45+
except FileNotFoundError:
46+
# the image is optional; the example works without it
47+
pass
4448

4549
records = (
4650
(3, '101', 'Spam'),

0 commit comments

Comments
 (0)