Although I can generate a presentation, populate text placeholders without issue and successfully save the generated presentation I am consistently getting an error when trying to populate a picture placeholder. I have confirmed that I am working with the correct placeholder object and that it is a picture placeholder (type 18). I have written the code to follow the examples from the online docs and, at this point, cannot figure out why I'm getting this error:
AttributeError: 'LayoutPlaceholder' object has no attribute 'insert_picture'
This is the section of code being executed, which throws the error after executing the last line:
# Bring in a new slide from layout and add to deck
objContentSlide = objPrs.slide_layouts[1]
objPrs.slides.add_slide(objContentSlide)
# Collect the placeholders
objContentShapes = objContentSlide.placeholders
# Populate title placeholder (text)
objContentSlideTitle = list(filter(lambda x: x.name == "slide1Title",objContentShapes))[0]
objContentSlideTitle.text = CNSDETAILSLIDETITLEPREFIX + strMonthName + CNSDETAILSLIDETITLESUFFIX
# Populate forecast placeholder (text)
objContentSlideForecast = list(filter(lambda x: x.name == "slide1Forecast",objContentShapes))[0]
objContentSlideForecast.text = CNSDETAILSLIDEFORECASTPREFIX + strRandomNumber0
# Populate assumptions placeholder (text)
objContentSlideAssumptions = list(filter(lambda x: x.name == "slide1Assumptions",objContentShapes))[0]
objContentSlideAssumptions.text = CNSDETAILSLIDEASSUMPTIONSPREFIX + CNSDETAILSLIDEASSUMPTIONSSTAGE + CNSDETAILSLIDEASSUMPTIONSSUFFIX + strRandomNumber1
# Populate screenshot
objContentSlideScreenshot = list(filter(lambda x: x.name == "slide1Screenshot",objContentShapes))[0]
plcName = objContentSlideScreenshot.name # Returns "slide1Screenshot"
plcType = objContentSlideScreenshot.placeholder_format.type # Returns 18
objContentSlideScreenshot.insert_picture("testShot.png",0,0)
I don't usually work in Python (but am completely enjoying) so please let me know if there is a glaring convention problem that I am unaware of.