Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pass command line arguments to Bokeh server application

Tags:

bokeh

I have a Bokeh server application. I would like to pass it custom options on the command line:

bokeh serve /path/to/script.py --my-option foo

Is this possible? Will Bokeh pass these options through somehow?

like image 894
MRocklin Avatar asked Feb 06 '23 21:02

MRocklin


1 Answers

Yes, use the --args command line option described in the User's Guide. Everything you put after the --args option will just appear in sys.argv for the app code, just as you would expect with any normal python script.

Running this app:

import sys
print(sys.argv)

With this invocation:

bokeh serve foo.py --args -x 1 bar --baz

Then opening a session will result in this being printed:

['foo.py', '-x', '1', 'bar', '--baz']
like image 71
bigreddot Avatar answered May 16 '23 03:05

bigreddot