I'm trying to save a .pptx file to DBFS in my Databricks environment using the python-pptx
package but receiving the following error:
[Errno 95] Operation not supported
When I just run prs.save('test.pptx')
it runs without error but I don't understand where it's going.
Any guidance would be appreciated. Here's an example that returns the above error:
prs = Presentation()
title_slide_layout = prs.slide_layouts[0]
slide = prs.slides.add_slide(title_slide_layout)
title = slide.shapes.title
subtitle = slide.placeholders[1]
title.text = "Hello, World!"
subtitle.text = "python-pptx was here!"
prs.save('/dbfs/test.pptx')
This is caused by the DBFS Fuse limitations, specifically, lack of support of random writes that are required to create PPTX file. The solution would be to write file to local file system, and move to the DBFS after it's written:
prs.save('/tmp/test.pptx')
dbutils.fs.mv('file:///tmp/test.pptx', '/test.pptx')