scanny / python-pptx

Create Open XML PowerPoint documents in Python
MIT License
2.26k stars 499 forks source link

Why do I get an error message 'Part' object has no attribute 'sha1' when adding a video #910

Open NearStart opened 10 months ago

NearStart commented 10 months ago

Hi guys, I want to add a video to the new slideshow. The format of the video is "mp4", but some presentations are fine, but some will report an error 'Part' object has no attribute 'sha1'. Any suggestions very much helpful.

my code is as follow: prs = Presentation(...) video = "..." cover = "..." slide_layout = prs.slide_layouts[master_index] slide = prs.slides.add_slide(slide_layout) slide.shapes.add_movie(video, poster_frame_image=cover, left=Cm(1.59), top=Cm(6.51), width=Cm(20.20), height=Cm(11.02))

scanny commented 8 months ago

Try adding mime_type="video/mp4" as a parameter to add_movie().