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

update in_notebook check #13

Closed
wants to merge 1 commit into from

Conversation

dfeinzeig
Copy link

@dfeinzeig dfeinzeig commented Aug 31, 2021

when ipython is installed with django, it'll sometimes try and use it automatically. when trying to run a django management command with ipython installed i was seeing

AttributeError: 'NoneType' object has no attribute 'config'

@dfeinzeig dfeinzeig changed the title Update progress_bar.py update in_notebook check Aug 31, 2021
Copy link
Owner

@sybrenjansen sybrenjansen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a line to docs/changelog.rst describing the bugfix? There's no new version yet, so you can add something like:

Master
------

* <insert description>

at the top of the file.

@sybrenjansen sybrenjansen added the bug Something isn't working label Sep 3, 2021
@@ -142,7 +142,7 @@ def _progress_bar_handler(self, tqdm_connection_details: TqdmConnectionDetails,

# In case we're running tqdm in a notebook we need to apply a dirty hack to get progress bars working.
# Solution adapted from https://github.com/tqdm/tqdm/issues/485#issuecomment-473338308
in_notebook = 'IPython' in sys.modules and 'IPKernelApp' in sys.modules['IPython'].get_ipython().config
in_notebook = 'IPython' in sys.modules and sys.modules['IPython'].get_ipython() is not None and 'IPKernelApp' in sys.modules['IPython'].get_ipython().config
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's getting a bit out of hand with the big if statement. Perhaps we should simply let it fail and handle that instead:

        try:
            in_notebook = 'IPKernelApp' in sys.modules['IPython'].get_ipython().config
        except (AttributeError, KeyError):
            in_notebook = False

sybrenjansen pushed a commit that referenced this pull request Oct 13, 2021
…nd django installed (`#13`_)Fixed progress bar in a particular setting with iPython and django installed
@sybrenjansen
Copy link
Owner

I'm closing this PR because there hasn't been any activity in quite some time.

I will add the fix proposed here to another PR today.

sybrenjansen added a commit that referenced this pull request Oct 15, 2021
* Fixes #13 - Fixed progress bar in a particular setting with iPython and django installed
* Fixes #15 - ``keep_alive`` now works even when the function to be called or any other parameter passed to the ``map`` function is changed
* Moved ``enable_insights`` to the WorkerPool constructor. Using ``enable_insights`` from a ``map`` function is now deprecated and will be removed in MPIRE v2.6.0.
* Restructured docs and updated several sections for Windows users.

Co-authored-by: sybrenjansen <sybren.jansen@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants