question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`with logging.disable('WARN')` wrecks IPython

See original GitHub issue
import logging
with logging.disable('WARN'): pass

demo.mp4. Not reproduced if ran as script. Win10 x64, IPython 7.19.0, Python 3.7.7.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Carreaucommented, Dec 15, 2020

Also your bottom code snippet still crashes IPython for me.

Yes, the point of this code snippet is that it fails even outside of IPython; and there for that the error is not in IPython itself.

I’ll follow up upstream.

0reactions
MrMinocommented, Apr 21, 2021

IIUC this has been resolved upstream.

In 3.9.1:

In [1]: import logging
   ...: with logging.disable('WARN'): pass
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-1-bbe58e505dd2> in <module>
      1 import logging
----> 2 with logging.disable('WARN'): pass

AttributeError: __enter__
Read more comments on GitHub >

github_iconTop Results From Across the Web

python - How to disable logging on the standard error stream?
@NealWalters For the 1st solution, you would create a handler: handler = logging.NullHandler() , add it to the logger and disable propagation to...
Read more >
Terminal IPython options — IPython 8.7.0 documentation
This directory is used for logging configuration (through profiles), history storage, etc. The default is usually $HOME/.ipython.
Read more >
Basic usage of python logging module - CLEX CMS Blog
logging.warning('This is a warning message this should be printed on your console') ... disable the root logger handlers and start afresh.
Read more >
Errors, Logging, and Debugging - Hydro-Informatics
logging.critical("message") for critical errors that may lead to program (Python) crashes. Warning, error, and critical messages should be implemented in ...
Read more >
IPython reference — IPython 3.2.1 documentation
You can control how many results are kept in memory with the configuration option InteractiveShell.cache_size . If you set it to 0, output...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found