0

I'm trying to run a code that is a combination of flask and bokeh, however, I get the following error:

KeyError: "View model name 'panel.models.tabulator.DataTabulator' not found"

The code snippet:

from bokeh.client import pull_session
from bokeh.embed import server_session
from flask import Flask, render_template, request, redirect, url_for

...

@app.route('/', methods=['GET'])
@cross_origin()
def getup():
    filenames = os.listdir(app.config['UPLOAD_FOLDER'])
    filename = None

    args = {'filename':filename} if filename else None
    with pull_session(url="http://127.0.0.1:5006/bokeh/server", arguments=args) as session:  # Error is in this line
        # generate a script to load the customized session 
        script = server_session(session_id=session.id,
         url="http://127.0.0.1:5006/bokeh/server")

    # use the script in the rendered page 
    return render_template("index.html", script=script, template="Flask", 
        filenames=filenames, selected_fn=filename)

if __name__ == '__main__':
    app.run(host="0.0.0.0", port=5000, debug=True)

Also, bokeh is running by the following command:

bokeh serve src/server --allow-websocket-origin="127.0.0.1:5000" --allow-websocket-origin=\* --prefix=bokeh
Benyamin Jafari
  • 27,880
  • 26
  • 135
  • 150
  • `panel` is not a part of Bokeh. It is built on top of Bokeh and has additional functionality. I think to take advantage of its features you would need to run [`panel serve`](https://panel.holoviz.org/user_guide/Server_Deployment.html) not `bokeh serve` – bigreddot Jul 20 '22 at 19:29
  • @bigreddot Thanks for mentioning it. I also tried with `panel server` rather than `bokeh server` but I got the same error. – Benyamin Jafari Jul 20 '22 at 19:35
  • You might have more luck asking on the Holoviz Discourse, which is a support forum run by the creators of Panel: https://discourse.holoviz.org – bigreddot Jul 20 '22 at 19:44

0 Answers0