0

I'm trying to make a TextAreaInput to scroll-down automatically with every text update, when I tried to used CustomJS, I found this error on the browser generated script:

Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing

and this error on the browser console:

TypeError: Cannot read property 'connect' of undefined

and

[bokeh] Failed to repull session TypeError: Cannot read property 'connect' of undefined

Although, I reduced the javascript code to "nothing", the same error appears. Here's the code snippet

from bokeh.models.widgets import TextAreaInput
from bokeh.models import CustomJS

class projectdata:
    def __init__(self, doc):
        self.textarea = TextAreaInput(value="XER file contents will show here!", rows = 10, name="textarea", css_classes=["mytext"])
        callback = CustomJS(args=dict(text=self.textarea),code="""""")
        self.textarea.js_on_change('scroll', callback)

Python: 3.7.3, Bokeh: 1.3.4, Browser: Chrome

Thanks

Ahmad
  • 13
  • 2
  • The issue is not in that snippet. The issue is in however you are generating output, so more information is needed. – bigreddot Dec 11 '19 at 13:07
  • My original code contains many widgets and OnClick handlers, all works fine, the error only appeared when I tried to use the CustomJS callback, see, there’s no JavaScript code, so maybe the error is in the way I invoke the TextAreaInput, or there’s a problem with the preloaded BokehJS files, I work with Bokeh 1.3.4 and it’s currently 1.4, I will make a test for CustomJS callback on Button click, if I get the same error then the problem is not the widgets – Ahmad Dec 11 '19 at 17:45
  • If you are saying that you are using one version of Python Bokeh and a different bokehjs version is 100% unsupported. The python/js versions absolutely must match exactly. – bigreddot Dec 11 '19 at 20:18

2 Answers2

0

After trials, I found the error cause was "scroll" in the line

self.textarea.js_on_change('scroll', callback)

the correct name should be "value"

self.textarea.js_on_change('value', callback)

after that small change, all works fine, but still working on the automatic scroll for TextArea

Ahmad
  • 13
  • 2
-2

Well the first error is telling you that you do not have https://pypi.org/project/bokeh/

  • It's not saying that. It's saying the page being rendered does not properly load the *JavaScript* BokehJS library. – bigreddot Dec 11 '19 at 13:07