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

Only warnings are displayed from param in ipython notebooks? #68

Open
ceball opened this issue Nov 12, 2014 · 7 comments
Open

Only warnings are displayed from param in ipython notebooks? #68

ceball opened this issue Nov 12, 2014 · 7 comments
Labels
component: ipython ipython/notebook/jupyter support component: log/warn/error type-bug Bug report
Milestone

Comments

@ceball
Copy link
Member

ceball commented Nov 12, 2014

Logging seems to behave differently under ipython notebook vs. python

Python:

>>> import param
>>> param.Parameterized().warning('hi')
WARNING:root:Parameterized00002: hi
>>> param.Parameterized().message('hi')
INFO:root:Parameterized00003: hi
>>> param.parameterized.get_logger().isEnabledFor(param.parameterized.INFO)
True

In a notebook, however, I only get the warning message (not the info):
ipython-logging

@ceball
Copy link
Member Author

ceball commented Nov 13, 2014

How this has been addressed in topographica (I guess):

# Create new logger to ensure param logging shows in notebooks
iplogger = logging.getLogger('ip-param')
iplogger.addHandler(logging.StreamHandler(stream=sys.stderr))
iplogger.propagate = False
param.parameterized.logger = iplogger

https://github.com/ioam/topographica/blob/master/platform/ipython/profile_topo/startup/notebook_setup.py#L11

@jbednar
Copy link
Member

jbednar commented Nov 13, 2014

Does that seem like something that could go into param instead? If so, I'm happy to see things move out of Topographica and into lower-level libraries where they make sense...

@jlstevens
Copy link
Contributor

You can move this to param if you like.

This was added because param logging behaved badly in IPython Notebooks without it. If you have a better idea of how info messages should behave in notebooks, go ahead and implement it.

@ceball ceball added this to the 1.6.0 milestone Aug 28, 2017
@ceball
Copy link
Member Author

ceball commented Aug 28, 2017

Check if this is still a problem

@ceball ceball removed this from the 1.6 milestone Apr 13, 2020
@ceball ceball added component: ipython ipython/notebook/jupyter support type-bug Bug report labels Apr 13, 2020
@jbednar jbednar added this to the v1.10.0 milestone Jul 6, 2020
@FRidh
Copy link

FRidh commented Aug 11, 2020

Not sure if this is the right ticket, but it seems not possible to hide param warnings in a notebook with

import warnings
warnings.filterwarnings('ignore')

Only the following hack at the end of the execution works:

%%javascript
$('div.output_stderr').hide();

@ablythed ablythed modified the milestones: v1.10.2, v1.10.3 Jun 28, 2021
@MridulS MridulS modified the milestones: v1.11.2, v1.12.1 Feb 7, 2022
@maximlt
Copy link
Member

maximlt commented Oct 31, 2022

Not sure if this is the right ticket, but it seems not possible to hide param warnings in a notebook with

Indeed param warnings are using Python's logging to cannot be filtered via the warnings module. You have to manipulate param's logger to hide the warnings.

@jbednar
Copy link
Member

jbednar commented Oct 31, 2022

I think the Aug 11, 2020 issue is the opposite of this one; both are worth addressing, but separately (e.g. by making Param warnings use warnings rather than logging, and making the fix in this issue).

@droumis droumis modified the milestones: v1.12.x, v2.x Jan 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: ipython ipython/notebook/jupyter support component: log/warn/error type-bug Bug report
Projects
None yet
Development

No branches or pull requests

8 participants