How to debug javascript in bokeh

Does anyone know if there is a way to see and debug javascript in a callback that is run in bokeh? Any help is much appreciated, thank-you!

For instance, I am running very simple, static code to debug my slider but I can’t see the results from running the code in def update_line because it is in javascript:

def update_line(source=source, window=None):

data = source.data

source[‘selected’][‘2d’].indices = {4: [5, 6]}

source.change.emit()

###call slider

slider = Slider(start=1, end=3000, value=1, step=1, callback=CustomJS.from_py_func(update_line))

layout = column(slider, plot)

show(layout)

Hi,
In general, you can find a web development area for Javascript logging information.
In firefox, you can go to

tools -> web development -> web console
In safari, it’s
develop -> show javascript console

Tong

···

On Friday, 23 February 2018 23:06:51 UTC+1, [email protected] wrote:

Does anyone know if there is a way to see and debug javascript in a callback that is run in bokeh? Any help is much appreciated, thank-you!

For instance, I am running very simple, static code to debug my slider but I can’t see the results from running the code in def update_line because it is in javascript:

def update_line(source=source, window=None):

data = source.data

source[‘selected’][‘2d’].indices = {4: [5, 6]}

source.change.emit()

###call slider

slider = Slider(start=1, end=3000, value=1, step=1, callback=CustomJS.from_py_func(update_line))

layout = column(slider, plot)

show(layout)

Additionally, some things that can be useful:

* Adding "console.log(...)" statements to your callback code. This affords "printf debugging" output in the browser console.

* Adding "debugger" statements to your callback code. If the callback code executes when a browser JS dev window is open, a debugger should stop at that point where you can inspect variables, single step code, etc.

It would be super helpful if some of this information made it into the user's guide so if anyone wants to make a quick PR to add a "Debugging" section to the callbacks chapter, it would be extremely appreciated.

Thanks,

Bryan

···

On Feb 25, 2018, at 13:08, [email protected] wrote:

Hi,
In general, you can find a web development area for Javascript logging information.
In firefox, you can go to
tools -> web development -> web console
In safari, it's
develop -> show javascript console

Tong

On Friday, 23 February 2018 23:06:51 UTC+1, [email protected] wrote:
Does anyone know if there is a way to see and debug javascript in a callback that is run in bokeh? Any help is much appreciated, thank-you!

For instance, I am running very simple, static code to debug my slider but I can't see the results from running the code in def update_line because it is in javascript:

def update_line(source=source, window=None):
    data = source.data
    source['selected']['2d'].indices = {4: [5, 6]}
    source.change.emit()

###call slider
slider = Slider(start=1, end=3000, value=1, step=1, callback=CustomJS.from_py_func(update_line))

layout = column(slider, plot)

show(layout)

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/90707376-78b3-49e7-9249-138f3285145f%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.