Skip to content

Support path-like filenames when adding pictures - #1629

Open
LaoChouPro wants to merge 1 commit into
python-openxml:masterfrom
LaoChouPro:fix/pathlike-image-descriptors
Open

LaoChouPro wants to merge 1 commit into
python-openxml:masterfrom
LaoChouPro:fix/pathlike-image-descriptors

Conversation

@LaoChouPro

Copy link
Copy Markdown

Passing a pathlib.Path to add_picture currently treats it as a file-like object and fails on seek(). This accepts path-like filenames in the image loader and updates the related type annotations. Fixes #1544.

The tests cover string and Path inputs, both picture insertion methods, and saving and reopening a document with a Unicode image filename. All 1612 tests pass with pytest 8.4.2 and pyparsing 3.2.3, and both package builds pass. Pyright still reports the same two errors on the unchanged baseline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for pathlib.Path

1 participant