Closed beyarkay closed 3 years ago
This is the offending line: https://github.com/scanny/python-pptx/blob/master/pptx/oxml/shapes/picture.py#L69
The desc
parameter needs to be XML escaped to change the "&"
into "&"
.
Pretty sure this would do the trick:
from xml.sax.saxutils import escape
...
xml = cls._pic_tmpl() % (id_, name, escape(desc), rId, left, top, width, height)
...
Fixed in v0.6.20 due out here tonight or tomorrow.
Images containing the ampersand & character result in the cryptic error message such as:
This was referenced in issue 223: https://github.com/scanny/python-pptx/issues/223 from 26 Jul 2016. While this does not solve the issue, it makes temporary patch (removing ampersand characters) easier to find and easier to avoid by new users.