KeyNotFoundException: The Given Key '11677' Was Not Present in the Dictionary

I use ubuntu to create an empty pptx file through wps, open it in Python slide without doing anything and save it, and the above error will appear. At the same time, when exporting pptx as a video, if the background of the slide is a video, the exported video does not include the video of the slide. The version of Python slide is 23.8

@qm1,
Thank you for contacting support.

Please share the following:

  • input presentation file (if you used it)
  • code exampple that reproduces the error
  • code example that exports the presentation to video

This is a presentation file with an error in saving. Please refer to the attachment aaaa.pptx

import aspose.slides as slides
from aspose.slides.export import SaveFormat
from aspose.pydrawing import Size
from aspose.pydrawing.imaging import ImageFormat
# import pptx
s = slides.Presentation("/home/mi/Downloads/aaaa.ppt")

s.save("bbc.pptx", SaveFormat.PPTX)


--------------------------------------------------------------
return content:

Traceback (most recent call last):
  File "/home/mi/PyFile/py/ppt-to-video/asp.py", line 8, in <module>
    s.save("bbc.pptx", SaveFormat.PPTX)
RuntimeError: Proxy error(KeyNotFoundException): The given key '11677' was not present in the dictionary.

I used the C++language to convert pptx into a video. In the interface where pptx goes to the video, I couldn’t find the content to generate the video because I couldn’t associate FrameTickEventArgs with PresentationAnimationsGenerator or PresentationPlayer. If there is a Python language, can you provide examples. Please refer to the attachment aacc1.zip (1021.3 KB)
.pptx

System::String save_dir;

void OnFrameTick(System::SharedPtr<PresentationPlayer> sender, System::SharedPtr<FrameTickEventArgs> args)
{
    args->GetFrame()->Save(System::String::Format(u"{0}/frame_{1}.png", save_dir, sender->get_FrameIndex()), System::Drawing::Imaging::ImageFormat::get_Png());
}

void SaveFrames(System::String path)
{
    const int32_t FPS = 30;
    auto presentation = System::MakeObject<Presentation>(path);
    auto slide = presentation->get_Slides();
    auto animationsGenerator = System::MakeObject<PresentationAnimationsGenerator>(presentation);

    auto player = System::MakeObject<PresentationPlayer>(animationsGenerator, FPS);
    player->FrameTick += OnFrameTick;

    animationsGenerator->Run(slide);
}


int main(int argc, char *argv[])
{   
    System::String pptx_path = System::String::Format(u"{0}", argv[1]);
    
    save_dir=System::String::Format(u"{0}", argv[2]);
    SaveFrames(pptx_path);
    
    return 0;
}

1.zip (1021.3 KB)

@qm1,
Thank you for the additional information. I am working on the issue and will get back to you as soon as possible.

@qm1,

Please share the following additional information:

  • Ubuntu version you used
  • Python version you used

As for presentation to video conversion, we have opened the following new ticket(s) in our internal issue tracking system and will consider the question according to the terms mentioned in Free Support Policies.

Issue ID(s): SLIDESPYNET-129

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Python Version is 3.8 . Ubuntu version is 20.04.

@qm1,
Thank you for the additional information. I will get back to you as soon as possible.

@qm1,

Unfortunately, I have not managed to reproduce the error you described. We need more information and details to do this.

Thank you very much for your reply. Could you please use this pptx file to retest again? I ran the program on two machines with an exception on 20.04. It has different given key id on two machines.

import aspose.slides as slides
from aspose.slides.export import SaveFormat
path = "ending-8.pptx"
p = slides.Presentation(path)
p.save("test.pptx", SaveFormat.PPTX)
Traceback (most recent call last):
  File "/home/mi/PyFile/py/ppt-to-video/asp.py", line 5, in <module>
    p.save("test.pptx", SaveFormat.PPTX)
RuntimeError: Proxy error(KeyNotFoundException): The given key '11677' was not present in the dictionary.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
RuntimeError: Proxy error(KeyNotFoundException): The given key '11711' was not present in the dictionary.

ending.zip (1.3 MB)

@qm1,
Thank you for the sample presentations. Unfortunately, I was still unable to reproduce the error you described.

Okay, I understand. Could you please provide me with a Python version of the code to convert pptx into a video? Thank you very much.

@qm1,
Aspose.Slides for Python does not yet support converting presentations to videos. We will provide a sample code when the conversion is possible.