0

Anyone came around the following Bokeh value error. Any quick fix?

File "C:\ProgramData\Anaconda3\lib\site-packages\bokeh\resources.py", line 218, in __init__
            "'inline', 'cdn', 'server(-dev)', 'relative(-dev)' or 'absolute(-dev)', got %r" % self.mode)

ValueError: wrong value for 'mode' parameter, expected 'inline', 'cdn', 'server(-dev)', 'relative(-dev)' or 'absolute(-dev)', got 'BOKEH_RESOURCES=inline'

Python code I am using is given below,

from bokeh.plotting import figure, show, output_file

from bokeh.resources import CDN

from bokeh.embed import file_html

x = elastic_Rest_y_disp
A = figure(title="Wing Station vs Shear Force along y direction",y_range=(500,38000),plot_width=900, plot_height=700,toolbar_location="left",toolbar_sticky=False)

A.xaxis.axis_label = "Wing Station"

A.yaxis.axis_label = "Force (lbs)"

A.line(x, elastic_Rest_CY, legend="elastic_Rest_CY",line_color="black", line_dash=[4, 4],line_width=2)
A.square(x, elastic_Rest_CY, legend="elastic_Rest_CY", fill_color=None, line_color="green") 

A.legend.location = "top_right"    

output_file("GFEM_vs_CB_elastic_y.html",**mode="inline"**, title="Wing Station vs Shear Force along y direction")

show(A)
1
  • Where’s the code where you are calling bokeh? Don’t forget to include a minimal complete verifiable example: stackoverflow.com/help/mcve
    – Aaron Paul
    Commented Sep 18, 2017 at 0:03

1 Answer 1

1

BOKEH_RESOURCES is an environment variable. It's a way to specify an override for resource from the command line, when you run your script. On a Linux system, you'd run something like:

BOKEH_RESOURCES=inline python myscript.py

i.e. not pass it as a parameter in Python code (which is what you appear to be doing).

I believe on Windows you would do:

set BOKEH_RESOURCES=inline

then

python myscript.py
5
  • Thank you for the answer. I am running the python program through spyder GUI, So how can i set this in Spyder? Commented Sep 18, 2017 at 3:22
  • Spyder might have a configuration option to set env vars when running scripts, I don't know for sure (I don't use Spyder). Otherwise if you are using output_file in the script yo are running, you can alterantively pass mode="inline" to output_file in the script, instead of using an env var.
    – bigreddot
    Commented Sep 18, 2017 at 16:11
  • I have seen that "BOKEH_RESOURCES=inline" is already present in my environment variables(windows). In that case we need not give it every time we run a python code. Also i tried adding mode="inline" to the output_file in the python script, but same error exists. I tried python, it is working . I am just trying to somehow do this in windows.Any help? Commented Sep 18, 2017 at 20:00
  • Do you have 'BOKEH_RESOURCES=inline' as the value of the BOKEH_RESOURCES env var? That is what the code above is telling, that it has been set along the lines of BOKEH_RESOURCES='BOKEH_RESOURCES=inline'
    – bigreddot
    Commented Sep 18, 2017 at 20:09
  • Ohh. I have missed that. Now i made it correct in environmental variable. It working fine with spyder now. Thank you for your help. Commented Sep 18, 2017 at 20:46

Not the answer you're looking for? Browse other questions tagged or ask your own question.