Commit 8ce25d1
committed
Traceback to help fixing double-calls to mpl.use.
Example session:
$ python -c 'import matplotlib as mpl; mpl.use("agg"); import matplotlib.pyplot; mpl.use("qt5agg")'
-c:1: UserWarning:
This call to matplotlib.use() has no effect because the backend has already
been chosen; matplotlib.use() must be called *before* pylab, matplotlib.pyplot,
or matplotlib.backends is imported for the first time.
The backend was *originally* set to 'agg' by the following code:
File "<string>", line 1, in <module>
File "/home/antony/src/extern/matplotlib/lib/matplotlib/pyplot.py", line 68, in <module>
from matplotlib.backends import pylab_setup
File "/home/antony/src/extern/matplotlib/lib/matplotlib/backends/__init__.py", line 14, in <module>
line for line in traceback.format_stack()
(In practice, you'd expect the two calls to be further apart from each
other, of course.)
Note that the *current* traceback can be accessed by standard means,
e.g. by setting the warnings filter.
Not sure how easy this is to test.1 parent acf2953 commit 8ce25d1
2 files changed
Lines changed: 17 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1341 | 1341 | | |
1342 | 1342 | | |
1343 | 1343 | | |
1344 | | - | |
1345 | | - | |
1346 | | - | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
1347 | 1347 | | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
1348 | 1351 | | |
1349 | 1352 | | |
1350 | 1353 | | |
| |||
1385 | 1388 | | |
1386 | 1389 | | |
1387 | 1390 | | |
1388 | | - | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
1389 | 1397 | | |
1390 | 1398 | | |
1391 | 1399 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
12 | 17 | | |
13 | 18 | | |
14 | 19 | | |
| |||
0 commit comments