Cannot save folium map as html

Hello,

I’m trying to save a map created with folium in HTML but I get the error:

AttributeError: ‘NoneType’ object has no attribute ‘save’

This is what I did and I don’t see the error:

        mapa = map_coropleta_fol(df)
        c13, c14, c15, c16, c17 = st.columns([1,1,1,1,1])
        with c15:
            export_mapa = st.button("Descargar Mapa")
            if export_mapa:
                mapa.save("mapa.html")
                st.success("¡Mapa Descargado!")

Any idea?

Do you expect None to have a method save()? Or do you expect map_coropleta_fol() to return something other than None?

Hi @Goyo function map_coropleta_fol() return a choropleth map and that map wants to be downloaded on a web page (.html).

The error message suggest otherwise.

My mistake was not placing the download button within the “map_coropleta_fol” function.

With this arrangement I can download the map.

Rookie mistake.

Thanks.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.