On Jun 29, 2017, at 13:44, Tyler Nickerson <[email protected]> wrote:
There are two issues that are preventing bokeh server from running your script. The first is that __name__ will not equal '__main__' when the script is executed using bokeh server. The second issue is that packing your script inside a function call will prevent bokeh server from finding what it needs to run your code. If you move the body of your code out of main() and remove the __name__ == '__main__' condition, it should work as intended. Here’s an example of what I mean:
import pandas as
# This import only works in 3.X
from io import
# attempt to cover 2.X use
from StringIO import
from bokeh.layouts import
from bokeh.models import
from bokeh.palettes import
from bokeh.plotting import
# trimmed down example data set
1101163308494.txt,5/13/2004,ORG, Alderwood High School
1101163308494.txt,5/13/2004,PER, Stacey Gorski
# mostly unchanged code, now outside of main()
df = pd.read_csv(StringIO(data))
'Filename'] = df['Filename'
'Date'] = df['Date'
'EntityType'] = df['EntityType'
'EntityValue'] = df['EntityValue'
columns = sorted(df.columns)
discrete = [x
for x in columns if
df.dtype == object]
continuous = [x
for x in columns if x not in
quantileable = [x
for x in continuous if len(df.unique()) > 20
xs = df[x.value].values
ys = df[y.value].values
x_title = x.value.title()
y_title = y.value.title()
kw = dict()
if x.value in
] = sorted(set(xs))
if y.value in
] = sorted(set(ys))
'title'] = "%s vs %s"
% (x_title, y_title)
p = figure(plot_height=
400, plot_width=400, tools='pan,box_zoom,reset'
p.xaxis.axis_label = x_title
p.yaxis.axis_label = y_title
p.circle(x=xs, y=ys, line_color=
"white", alpha=0.6, hover_color='white', hover_alpha=0.5
def update(attr, old, new):
] = create_figure()
x = Select(title=
y = Select(title=
controls = widgetbox([x, y], width=
layout = row(controls, create_figure())
# __name__ == '__main__' condition removed
On Friday, June 23, 2017 at 1:25:07 PM UTC-7, Lopamudra Pal wrote:
I implemented the crossfilter graph with our data. Issue faced - When outputting the result with bokeh.io.show method, I get the desired graph but with no interactions possible. However if I run the script as a bokeh application using "bokeh serve script.py --show", I get a blank webpage. I tried figuring out the issue for quite a while but still cannot identify what might possibly be the problem. The script works fine with the bokeh team's sample data though. Any suggestions would really be helpful.
Note:- Our data does not have any integer or float values. Hence I have commented out the continuous and quantileable parts from the original example code.
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/6d845ecc-1479-4442-be65-396f09e2427e%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.