bokeh server scripts to take command-line arguments

I am using bokeh v. 0.12.3, and got stuck at using the cli argument. This is my scripts

test.py

import sys
a = sys.argv[1]
print a

and cli I ran

bokeh serve test.py --args 1

but there is no output.

Would really appreciate if anyone can provide a minimal code snippet to illustrate how bokeh cli argument works.

Hi,

There is nothing wrong with your code. When you run

  bokeh serve test.py --args 1

That starts a Bokeh server that can server web pages with Bokeh applications. The code in test.py is *only* run when users open a browser to those pages. The default URL is going to be something like:

  http://localhost:5006/test

But for convenience, you can also add --show to the command line, and the bokeh server will automatically open a browser the correct URL:

  bokeh serve --show test.py --args 1

Of course, note that your code does not actually add any plots or widgets to the Bokeh document, so you will only see a blank page (but you will see the print statement in the console output where you ran "bokeh serve")

Thanks,

Bryan

···

On Dec 12, 2016, at 12:48 PM, [email protected] wrote:

I am using bokeh v. 0.12.3, and got stuck at using the cli argument. This is my scripts

test.py

import
sys
a
= sys.argv[1
]

print a

and cli I ran

bokeh serve test.py --args 1

but there is no output.

Would really appreciate if anyone can provide a minimal code snippet to illustrate how bokeh cli argument works.

--
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/deb52609-6b7a-4daf-a647-828aa572b41d%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.