BUG: Fix plot not saved as specified filename if run within notebook

Fixes https://github.com/kernc/backtesting.py/issues/45
This commit is contained in:
Kernc
2020-02-24 14:26:02 +01:00
parent 4b4b315e61
commit ab0cbe537e

View File

@@ -49,14 +49,12 @@ with open(os.path.join(os.path.dirname(__file__), 'autoscale_cb.js'),
def _bokeh_reset(filename=None): def _bokeh_reset(filename=None):
curstate().reset() curstate().reset()
# Test if we are in Jupyter notebook if filename:
if IS_JUPYTER_NOTEBOOK:
curstate().output_notebook()
elif filename:
if not filename.endswith('.html'): if not filename.endswith('.html'):
filename += '.html' filename += '.html'
output_file(filename, title=filename) output_file(filename, title=filename)
elif IS_JUPYTER_NOTEBOOK:
curstate().output_notebook()
def colorgen(): def colorgen():