korymath / talk-generator

talk-generator is capable of generating coherent slide decks based on a single topic suggestion.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WEBP image format throws exception

korymath opened this issue · comments

commented
 * Finished generating slide 2 about bag of hamburger using Conclusion in 7.49 seconds *
Traceback (most recent call last):
  File "/Users/korymathewson/work/talk-generator/venv/lib/python3.6/site-packages/pptx/util.py", line 133, in get_prop_value
    return getattr(obj, cache_attr_name)
AttributeError: 'Image' object has no attribute '_ext'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/korymathewson/work/talk-generator/talkgenerator/slide/powerpoint_slide_creator.py", line 91, in _add_image
    placeholder = placeholder.insert_picture(image_url)
  File "/Users/korymathewson/work/talk-generator/venv/lib/python3.6/site-packages/pptx/shapes/placeholder.py", line 323, in insert_picture
    pic = self._new_placeholder_pic(image_file)
  File "/Users/korymathewson/work/talk-generator/venv/lib/python3.6/site-packages/pptx/shapes/placeholder.py", line 334, in _new_placeholder_pic
    rId, desc, image_size = self._get_or_add_image(image_file)
  File "/Users/korymathewson/work/talk-generator/venv/lib/python3.6/site-packages/pptx/shapes/placeholder.py", line 345, in _get_or_add_image
    image_part, rId = self.part.get_or_add_image_part(image_file)
  File "/Users/korymathewson/work/talk-generator/venv/lib/python3.6/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 "/Users/korymathewson/work/talk-generator/venv/lib/python3.6/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 "/Users/korymathewson/work/talk-generator/venv/lib/python3.6/site-packages/pptx/package.py", line 161, in get_or_add_image_part
    image_part = ImagePart.new(self._package, image)
  File "/Users/korymathewson/work/talk-generator/venv/lib/python3.6/site-packages/pptx/parts/image.py", line 44, in new
    partname = package.next_image_partname(image.ext)
  File "/Users/korymathewson/work/talk-generator/venv/lib/python3.6/site-packages/pptx/util.py", line 135, in get_prop_value
    value = f(obj)
  File "/Users/korymathewson/work/talk-generator/venv/lib/python3.6/site-packages/pptx/parts/image.py", line 244, in ext
    raise ValueError(tmpl % (ext_map.keys(), format))
ValueError: unsupported image format, expected one of: dict_keys(['BMP', 'GIF', 'JPEG', 'PNG', 'TIFF', 'WMF']), got 'WEBP'
_add_image error: unsupported image format, expected one of: dict_keys(['BMP', 'GIF', 'JPEG', 'PNG', 'TIFF', 'WMF']), got 'WEBP'
commented

These errors are now caught and handled by generating a new slide.