Can't save plotly as .png with kaleido v1

Hi. I have two Shiny apps (RStudio) which were working fine until last week. On both I use kaleido from plotly to save an image as a .png file to attach it to a pdf file which can be downloaded, with the save_image() function.

This is the error when the function save_image() is called:

Warning: Error in py_get_attr: AttributeError: module ‘kaleido’ has no attribute ‘scopes’
Run reticulate::py_last_error() for details.

I saw kaleido is now on version v1, which no longer has the scopes attribute (The release message says this: “If your code uses Kaleido directly: kaleido.scopes.plotly has been removed in v1. Kaleido v1 provides write_fig and write_fig_sync for exporting Plotly figures.”). However, just replacing ‘save_image’ with these codes is not working for me.

I would be beyond grateful if someone could help me! :slight_smile:

Hi - Plotly is currently focused on improving support for image generation from Python applications, so support for Shiny isn’t currently in our roadmap. If someone from the community would like to implement an upgrade, we’d be happy to help review. Thanks - Greg (Plotly Libraries team manager, greg.wilson@plot.ly)