Search code examples
python-3.xbokeh

I just upgraded my Python Bokeh to 0.12.4 I get error JSON object has wrong type string


I just upgraded my Python Bokeh to 0.12.4 I get error JSON object has wrong type string. I don't have any local static CDN libraries. There is some info here but it is confusing. Does anybody have a simple answer for how to fix?

Note: my bokeh works fine in Jupyter. It is failing in the Flask web embedding case here:

script, div = components(plot) return render_template('graph.html',
script=script, div=div)

where the graph.html template looks like this:

<link
    href="http://cdn.bokeh.org/bokeh/release/bokeh-0.12.4.min.css"
    rel="stylesheet" type="text/css">
<link
    href="http://cdn.bokeh.org/bokeh/release/bokeh-widgets-0.12.4.min.css"
    rel="stylesheet" type="text/css">

<script src="http://cdn.bokeh.org/bokeh/release/bokeh-0.12.4.min.js"></script>
<script src="http://cdn.bokeh.org/bokeh/release/bokeh-widgets-0.12.4.min.js"></script>

{{ script |safe }}

Solution

  • i had same error in my django template, when was upgrading from bokeh 0.12.6 to bokeh 0.12.14, so i had added the same bokeh static requirements

    <link rel="stylesheet" href="https://cdn.bokeh.org/bokeh/release/bokeh-0.12.14.min.css" type="text/css" />
    <link rel="stylesheet" href="https://cdn.bokeh.org/bokeh/release/bokeh-widgets-0.12.14.min.css" type="text/css" />
    <link rel="stylesheet" href="https://cdn.bokeh.org/bokeh/release/bokeh-tables-0.12.14.min.css" type="text/css">
    
    <script type="text/javascript" src="https://cdn.bokeh.org/bokeh/release/bokeh-0.12.14.min.js"></script>
    <script type="text/javascript" src="https://cdn.bokeh.org/bokeh/release/bokeh-api-0.12.14.min.js"></script>
    <script type="text/javascript" src="https://cdn.bokeh.org/bokeh/release/bokeh-widgets-0.12.14.min.js"></script>
    <script type="text/javascript" src="https://cdn.bokeh.org/bokeh/release/bokeh-tables-0.12.14.min.js"></script>