Support PathLike image and package file inputs by AlexanderWillner · Pull Request #1123 · scanny/python-pptx
Navigation Menu
{{ message }}
scanny / python-pptx Public
- Notifications You must be signed in to change notification settings
- Fork 683
Open
AlexanderWillner wants to merge 1 commit intoscanny:masterfrom
Open
Support PathLike image and package file inputs#1123
AlexanderWillner wants to merge 1 commit intoscanny:masterfrom
Support PathLike image and package file inputs#1123
AlexanderWillner wants to merge 1 commit intoscanny:masterfrom
Conversation
Copy link Copy Markdown
AlexanderWillner
commented
Mar 29, 2026
AlexanderWillner
commented
Summary
- accept
os.PathLikeinputs inImage.from_file() - accept
os.PathLikeinputs inPart._blob_from_file() - add regression coverage for
pathlib.Pathfile inputs
Why
python-pptx currently treats only str values as file paths in these helpers. Passing pathlib.Path falls through to the file-like branch and raises an AttributeError on .seek/.read assumptions.
Testing
PYTHONPATH=src python -m pytest tests/parts/test_image.py -qPYTHONPATH=src python -m pytest -o filterwarnings=ignore::pyparsing.warnings.PyparsingDeprecationWarning tests/opc/test_package.py tests/test_package.py -q- smoke-tested
slide.shapes.add_picture(Path(...), ...)with a JPEG fixture
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment