summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2025-09-10 16:08:20 +0100
committerMichael Williamson <mike@zwobble.org>2025-09-10 16:08:20 +0100
commit603f8b83c0389be91ca90a3cb7690d7f237699d8 (patch)
tree5bfbbe4433825f96345baac31f3833cbac4d5548
parent7b4f0c08362e2328d3c6df26465362a50c56478f (diff)
Create files once
-rw-r--r--mammoth/docx/__init__.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/mammoth/docx/__init__.py b/mammoth/docx/__init__.py
index fcb5da5..3848736 100644
--- a/mammoth/docx/__init__.py
+++ b/mammoth/docx/__init__.py
@@ -156,6 +156,8 @@ def _part_with_body_reader(document_path, zip_file, part_paths):
default=Numbering.EMPTY,
)
+ files = Files(None if document_path is None else os.path.dirname(document_path))
+
def read_part(name, reader, default=_undefined):
relationships = _read_relationships(zip_file, _find_relationships_path_for(name))
@@ -165,7 +167,7 @@ def _part_with_body_reader(document_path, zip_file, part_paths):
relationships=relationships,
styles=styles,
docx_file=zip_file,
- files=Files(None if document_path is None else os.path.dirname(document_path)),
+ files=files,
)
if default is _undefined: