Skip to content

Warn if MPLBACKEND is invalid. #6699

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

Merged
merged 1 commit into from
Jul 16, 2016

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Jul 6, 2016

I could be convinced to make this an error actually.

@NelleV
Copy link
Member

NelleV commented Jul 6, 2016

Hi Anthony,
Do you mind having the warning list the possible values? Something like:

("%s is not a valid backend. Valid backends are %s." % (s, the list of backends)

Else it looks good. I'd also be fine raising an error.

@anntzer
Copy link
Contributor Author

anntzer commented Jul 6, 2016

Actually the error message already contains the list of valid backends (you can see it by calling explicitly matplotlib.use("foo")); I'm just turning it into a warning.
Let's have a straw poll as to whether this should be an error or a warning?

@NelleV
Copy link
Member

NelleV commented Jul 6, 2016

I finally understand what is going on.

I think a warning is fine for now: that's the current behaviour when the matplotlibrc ba kend is set to an unknown backend so it is at least consistent with the behaviour when using matplotlibrc.

In general, I think it might be worth be more strict and throw errors when options are set to wrong values, but this behaviour needs to be consistent.

@tacaswell tacaswell added this to the 2.1 (next point release) milestone Jul 6, 2016
@tacaswell
Copy link
Member

I lean toward error as well.

@dopplershift
Copy link
Contributor

"In the face of ambiguity, resist the temptation to guess." I'd say the zen argues for an error here.

@tacaswell
Copy link
Member

Consensus seems to be to raise if invalid.

@anntzer anntzer force-pushed the warn-on-invalid-MPLBACKEND branch from cfb2d3d to 6125d81 Compare July 12, 2016 07:28
@anntzer
Copy link
Contributor Author

anntzer commented Jul 12, 2016

That makes the patch even more trivial.

@NelleV
Copy link
Member

NelleV commented Jul 12, 2016

Do you mind changing l. 1455 and l. 1105 (that will require more work) as well to have the error raised consistently.

@anntzer
Copy link
Contributor Author

anntzer commented Jul 12, 2016

Changing l.1455 is probably a no-go (because other applications may be using matplotlib and using -dfoo themselves -- that's the whole reason -d$backend is deprecated I think).

Changing l.1105 comes down to switching the default value of fail_on_error to True, right?

@tacaswell
Copy link
Member

I agree on 1455 having to stay as it is for being able to pass things through.

I ma not sure about L1105, that makes all rcparsing raise. That should probably get wider discussion.

@tacaswell tacaswell merged commit c718e61 into matplotlib:master Jul 16, 2016
@anntzer anntzer deleted the warn-on-invalid-MPLBACKEND branch July 16, 2016 18:42
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

Successfully merging this pull request may close these issues.

5 participants