0

I read this useful Flask + Bokeh AjaxDataSource and I was able to generate the sample plot. I tried to modify the code in such a way to have the html file defined in the templates folder and let the flask to render_template the html file by passing the div and script elements as below:

script, div = components(fig)
return render_template('testajax.html', script = script, div = div)

and my HTML file is as follows:

{% extends "template.html" %}
{% block content %} 
<div class="container">
    <div>
        {{ script | safe}}
        {{ div | safe}}
    </div>
</div>
{% endblock %}

With the above changes, I will get these errors:

WindowsError: [Error 32] The process cannot access the file because it is being used by another process.  

I think I do not have enough knowledge about the INLINE.render_js().

What is the issue and how can I resolve that? I appreciate your help.

Community
  • 1
  • 1
Hamid K
  • 983
  • 1
  • 18
  • 40
  • This does not seem to be a Bokeh issue. The error is coming from the operating system, and is saying that (for instance) the file you are trying to write to is already open by some other application. Perhaps you have the file open in an editor or web browser? – bigreddot May 15 '16 at 16:13
  • You are correct. I do not get the windows error anymore. However, something is not correct since I cannot see any plots. Should this work? or if I want to use AjaxDataSource I need to implement with INLINE.render_css() and INLINE.render_js(). Should I be able to implement it by using above HTML file? – Hamid K May 16 '16 at 17:01
  • It doesn't look like you are actually loading the BokehJS JavaScript and CSS anywhere? You need to do that as described here: http://bokeh.pydata.org/en/0.11.1/docs/user_guide/embed.html#components Alternatively, you need to template in the inline JS and CSS yourself. The script that `components` returns assumes that BokehJS is already loaded *somehow* – bigreddot May 16 '16 at 19:15
  • In my template.html, I have loaded BokehJs and CSS with these lines: – Hamid K May 16 '16 at 19:20

0 Answers0