I just wanted to share a little trick for using efficiently using the
--show argument with
bokeh serve on windows.
My pain is that my default browser is
edge and cannot be changed for reasons outside of my control. I could see that I could set the default browser for Bokeh/ Panel using the
BOKEH_BROWSER environment variable. But when I tried setting it to
firefox it did not work. After some reverse engineering of the
webbrowser module I found out I need to set
BOKEH_BROWSER="C:/Program\ Files/Google/Chrome/Application/chrome.exe %s &"
BOKEH_BROWSER="C:/Program\ Files\ (x86)/Mozilla\ Firefox/firefox.exe %s &"
or something similar.
It’s important you replace
“\” with “/” and
space with "\ "
so now I can run
python -m panel serve app.py --dev --show
and the app automatically opens in the right browser initially and when I change and save the code.