Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPython checking in verbose_optimization.py doesn't work #31

Open
trevorcampbell opened this issue Feb 14, 2019 · 0 comments
Open

IPython checking in verbose_optimization.py doesn't work #31

trevorcampbell opened this issue Feb 14, 2019 · 0 comments

Comments

@trevorcampbell
Copy link
Contributor

In optimization/verbose_optimization.py, the following code tries to check whether it's being run from within an IPython notebook:

try:  # pragma: no cover
               from IPython.display import display
               from ipywidgets import IntProgress, HTML, Box, VBox, HBox
               self.text = HTML(width='100%')
               self.progress = IntProgress(min=0, max=maxiters)
               #self.progresstext = Text(width='100%', disabled=True, value='0/{}'.format(maxiters))
               self.model_show = HTML()
               self.ipython_notebook = ipython_notebook
           except:
               # Not in Ipython notebook
               self.ipython_notebook = False

but when I run code in my shell (not a notebook) that calls this, self.ipython_notebook is True after this block executes.

According to this stackoverflow post, a good way to do this check is

try:
   get_ipython
   self.ipython_notebook=True
except:
   self.ipython_notebook=False

For reference:
python 3.6.7
ipython 6.5.0
ipywidgets 7.4.0
paramz 0.9.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant