Skip to content

Issue with folium rendering HTML in notebooks using papermill #1277

@lwasser

Description

@lwasser

Please add a code sample or a nbviewer link, copy-pastable if possible

Hi Colleagues.
I'm having some issues with how folium produces html outputs in the JSON of a jupyter notebook.
i posted my issue here in the papermill repo first:

nteract/papermill#482

@MSeal suggested that i post here.

I've been using papermill for a while to execute jupyter notebooks in a CI framework.

I'm running into an odd (i think?) bug. When i run a notebook with an interactive element that will require an iframe - case in point creating a map using leaflet (folium for python), it seems to be adding some code that makes the output render incorrectly.

I just ran one of my notebooks. Prior to running papermill, the iframe embed looked like this:
The important piece here is that the src=data:text/html part is correctly populated in the json.

"<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><iframe src=\"data:text/html;charset=utf-8;base64,

So folium renders plots correctly when run in a notebook. HOwever, When I run papermill and execute a notebook using papermill, I get the following below: notice that the src now begins with about:blank.

"<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><iframe src=\"about:blank\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" data-html=PCFET0NUWVBFIGh0bWw+C

@MSeal mentioned this could related to something associated with headless execution and browsers. this is a but out of my scope of knowledge but i wondered if you would be willing to help me understand what is happening and what a fix might be?

I am using folium 0.10.1. And am happy to provide any additional information below. I've tried this on mac and linux and get the same results.

Many thanks.

# Your code here

Problem description

nteract/papermill#482

[this should explain why the current behavior is a problem and what is the expected output.]

Expected Output

Output of folium.__version__

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions