notebook: problem with warnings module
The warnings module is behaving in unexpected ways, but only within a notebook. I’m using python 3.6.0.final.0 on windows 64 with notebook 4.4.1, jupyter_client 5.0.0, and jupyter_core 4.3.0, and ipython 5.3.0.
If I run ipython from the console and run the following code one line at a time:
import warnings
warnings.filterwarnings(action='ignore')
x = 1 + 1
warnings.resetwarnings()
x = 1 + 1
Everything runs as expected and there are no warnings displayed.
However, if I run the same code in a notebook with one line per cell, the following warning is displayed after cell 4 and again after cell 5:
C:\Anaconda\lib\json\encoder.py:199: DeprecationWarning: Interpreting naive datetime as local 2017-02-28 21:20:58.170463. Please add timezone info to timestamps.
chunks = self.iterencode(o, _one_shot=True)
Essentially, any time after running warnings.resetwarnings()
at any point in a notebook, every subsequent cell execution displays that warning message with the current timestamp.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 2
- Comments: 15 (4 by maintainers)
I am getting these warnings all in almost all cells.
Not sure why it happens.
Same issue
These warnings should be fixed with ipykernel 4.6.1, which is out on PyPI and should be up on conda-forge within a day or so.
It’s especially bad when you connect to a few hundred
ipyparallel
engines and this warning is printed many many times.Same here. Just updated my python packages to their latest versions and now getting these warning in every cell.