Skip to content

Error when doing add_picture to the presentation having svg images inside #382

Description

@yagelix

v0.6.9

When one is trying to call add_picture on a slide of a previously created presentation that has svg images
the following exception occured:

  File "/usr/local/lib/python2.7/site-packages/pptx/shapes/shapetree.py", line 263, in add_picture
    image_part, rId = self.part.get_or_add_image_part(image_file)
  File "/usr/local/lib/python2.7/site-packages/pptx/parts/slide.py", line 42, in get_or_add_image_part
    image_part = self._package.get_or_add_image_part(image_file)
  File "/usr/local/lib/python2.7/site-packages/pptx/package.py", line 50, in get_or_add_image_part
    return self._image_parts.get_or_add_image_part(image_file)
  File "/usr/local/lib/python2.7/site-packages/pptx/package.py", line 159, in get_or_add_image_part
    image_part = self._find_by_sha1(image.sha1)
  File "/usr/local/lib/python2.7/site-packages/pptx/package.py", line 172, in _find_by_sha1
    if image_part.sha1 == sha1:
AttributeError: 'Part' object has no attribute 'sha1'

It looks like '.svg' images are not recognized as ImagePart.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions