Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Store warnings or other stderr #295

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

Open
jnothman opened this issue Sep 26, 2017 · 10 comments
Open

Store warnings or other stderr #295

jnothman opened this issue Sep 26, 2017 · 10 comments

Comments

@jnothman
Copy link
Contributor

I would appreciate a feature where warnings (or perhaps any stderr output) produced by a gallery script was logged somewhere in an associated file. This would make it easier to find unwanted warnings, etc.

@lesteve
Copy link
Member

lesteve commented Sep 28, 2017

I guess you want to figure out which the example the warnings are coming from? Hmm I have to say that I generally pipe the output of make html to a file when I want to do this kind of stuff. Alternatively you could be creative with PYTHONWARNINGS and look at the exceptions which would tell you which example is to blame.

All in all I don't think this should be very high on the priority list of sphinx-gallery.

@jnothman
Copy link
Contributor Author

jnothman commented Sep 28, 2017 via email

@lesteve
Copy link
Member

lesteve commented Sep 28, 2017

I've found the output of make html not very informative. warnings not aligned with example names

Agreed that's why I suggested the PYTHONWARNINGS work-around ...

@Titan-C
Copy link
Member

Titan-C commented Sep 28, 2017 via email

@lesteve
Copy link
Member

lesteve commented Sep 28, 2017

I am not sure why you mention the summary which is good for exceptions but not for warnings (this is the reason I said a bit tongue-in-cheek use PYTHONWARNINGS, i.e. to turn warnings into exceptions so that the source would be easier to spot)

Look at this log:
https://circleci.com/api/v1.1/project/github/scikit-learn/scikit-learn/13935/output/10/0?file=true
and now tell me if it is easy to find which warnings is related to which file.

I suppose it does not help that we switched to sphinx logging. At least before we had the names of all the files ...

@lesteve
Copy link
Member

lesteve commented Sep 28, 2017

Just a quick example look for DataDimensionalityWarning

Generating gallery for auto_examples/applications [ 27%] plot_out_of_core_classification.py
/home/ubuntu/scikit-learn/sklearn/cross_validation.py:41: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. Also note that the interface of the new CV iterators are different from that of this module. This module will be removed in 0.20.
  "This module will be removed in 0.20.", DeprecationWarning)
/home/ubuntu/scikit-learn/sklearn/grid_search.py:42: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. This module will be removed in 0.20.
  DeprecationWarning)
/home/ubuntu/scikit-learn/sklearn/learning_curve.py:22: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the functions are moved. This module will be removed in 0.20
  DeprecationWarning)
[Parallel(n_jobs=1)]: Done   1 out of   1 | elapsed:    0.0s remaining:    0.0s
[Parallel(n_jobs=1)]: Done   2 out of   2 | elapsed:    0.0s remaining:    0.0s
[Parallel(n_jobs=1)]: Done   3 out of   3 | elapsed:    0.0s remaining:    0.0s
[Parallel(n_jobs=1)]: Done   4 out of   4 | elapsed:    0.0s remaining:    0.0s
[Parallel(n_jobs=1)]: Done   5 out of   5 | elapsed:    0.0s remaining:    0.0s
[Parallel(n_jobs=1)]: Done   6 out of   6 | elapsed:    0.1s remaining:    0.0s
[Parallel(n_jobs=1)]: Done   7 out of   7 | elapsed:    0.1s remaining:    0.0s
[Parallel(n_jobs=1)]: Done   8 out of   8 | elapsed:    0.1s remaining:    0.0s
[Parallel(n_jobs=1)]: Done   9 out of   9 | elapsed:    0.1s remaining:    0.0s
[Parallel(n_jobs=1)]: Done  54 out of  54 | elapsed:    0.5s finished
/home/ubuntu/scikit-learn/sklearn/random_projection.py:378: DataDimensionalityWarning: The number of components is higher than the number of features: n_features < n_components (64 < 300).The dimensionality of the problem will not be reduced.
  DataDimensionalityWarning)

You would be tempted to believe that examples/applications/plot_out_of_core_classification.py is to blame according to the log, nope, it is actually examples/plot_johnson_lindenstrauss_bound.py (which appears nowhere in the log, because of the switch to sphinx logging).

@jnothman
Copy link
Contributor Author

jnothman commented Sep 28, 2017 via email

@lesteve
Copy link
Member

lesteve commented Sep 28, 2017

Just to be clear by "sphinx logging" I meant changes introduced by this PR #250 and maybe others.

@lesteve
Copy link
Member

lesteve commented Sep 29, 2017

@QuLogic do you know off the top of your head if there is an easy way to configure sphinx logging (or maybe status iterator is the right word here) to be in "print each output on a separate line" mode?

@QuLogic
Copy link
Contributor

QuLogic commented Oct 1, 2017

If you pass non-zero verbosity, it appears it will do that. You could pass that based on some verbosity command-line flag (I assume sphinx captures this somewhere already.)

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

4 participants