{"id":20950,"library":"aspose-slides","title":"Aspose Slides for Python via .NET","description":"Aspose.Slides for Python via .NET is a class library that enables applications to read, write, manipulate, and convert PowerPoint presentations (PPT, PPTX, PPS, POT, PPSX, etc.) without requiring Microsoft PowerPoint. Version 26.4.0 supports Python 3.5 to 3.13. Releases occur monthly.","status":"active","version":"26.4.0","language":"python","source_language":"en","source_url":"https://github.com/aspose-slides/Aspose.Slides-for-Python-via-.NET","tags":["powerpoint","slides","presentation","conversion","pptx","ppt","aspose"],"install":[{"cmd":"pip install aspose-slides","lang":"bash","label":"Default install"}],"dependencies":[{"reason":"Required to bridge .NET runtime; installed automatically with aspose-slides.","package":"pythonnet","optional":false},{"reason":"Part of pythonnet; used to load .NET assemblies.","package":"clr","optional":false}],"imports":[{"note":"The top-level aspose.slides module does not directly export Presentation. You must import the module and access via slides.Presentation.","wrong":"from aspose.slides import Presentation","symbol":"Presentation","correct":"import aspose.slides as slides; pres = slides.Presentation()"},{"note":"","wrong":"","symbol":"ShapeType","correct":"from aspose.slides import ShapeType"},{"note":"SaveFormat is located in the export submodule, not directly in aspose.slides.","wrong":"from aspose.slides import SaveFormat","symbol":"SaveFormat","correct":"from aspose.slides.export import SaveFormat"}],"quickstart":{"code":"import aspose.slides as slides\n\n# Create a presentation\npres = slides.Presentation()\n\n# Add a slide and a shape\nslide = pres.slides[0]\nshape = slide.shapes.add_auto_shape(slides.ShapeType.RECTANGLE, 50, 50, 200, 100)\n\n# Add text\nshape.text_frame.text = 'Hello, Aspose.Slides!'\n\n# Save\npres.save('output.pptx', slides.export.SaveFormat.PPTX)\nprint('Presentation saved.')","lang":"python","description":"Creates a simple presentation with one slide, adds a rectangle with text, and saves as PPTX."},"warnings":[{"fix":"with slides.Presentation() as pres: ... or pres = slides.Presentation(); ...; pres.dispose()","message":"The Presentation class must be disposed to release .NET resources. Use a context manager or call dispose() explicitly to avoid memory leaks.","severity":"gotcha","affected_versions":"all"},{"fix":"Perform import once at module level, not inside functions/loops.","message":"Importing aspose.slides takes a few seconds because it loads .NET runtime. Do not import in hot loops.","severity":"gotcha","affected_versions":"all"},{"fix":"Update imports: from aspose.slides.export import SaveFormat instead of from aspose.slides import SaveFormat.","message":"In version 24.x, the aspose.slides namespace was restructured. Some classes moved to submodules (e.g., SaveFormat moved to aspose.slides.export).","severity":"breaking","affected_versions":">=24.0"},{"fix":"Use pres.slides[0] to access slides; iterate with for slide in pres.slides:","message":"The Slice class was renamed to Slide in older versions. Always use slides.Slide for slide objects.","severity":"gotcha","affected_versions":"all"},{"fix":"shape = slide.shapes.add_auto_shape(slides.ShapeType.RECTANGLE, left, top, width, height)","message":"Methods like add_rectangle() and add_ellipse() are deprecated. Use add_auto_shape() with ShapeType instead.","severity":"deprecated","affected_versions":">=24.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"pip install aspose-slides. Ensure you are using the correct Python interpreter/venv.","cause":"aspose-slides not installed or installed in wrong environment.","error":"ModuleNotFoundError: No module named 'aspose'"},{"fix":"Use 'import aspose.slides as slides' then 'slides.Presentation()'.","cause":"Wrong import pattern. Direct import from aspose.slides does not export Presentation.","error":"AttributeError: module 'aspose.slides' has no attribute 'Presentation'"},{"fix":"Check the Aspose.Slides for Python documentation for supported features. Consider using the .NET API directly via pythonnet if needed.","cause":"Some features from .NET are not yet available via Python wrapper. For example, certain chart types or complex formatting.","error":"NotImplementedError: The method or operation is not implemented."},{"fix":"Use for i in range(len(slide.shapes)): and access via index, or collect items in a list first.","cause":"Modifying shapes collection while iterating over it without using index-based loops.","error":"System.InvalidOperationException: Collection was modified; enumeration operation may not execute."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}