I have currently written a python script (call it detect.py) that checks to see if a new file has been added to a directory. If so, it calls another Python script (call it program.py) that takes the new file as input and uses matplotlib to plot graphs. However, instead of plotting and saving images, I get the resulting output:
From what I understand, Matplotlib is explicitly prone to multi-threading errors. Does this mean I cannot create an automated script for detecting new files and running a matplotlib analysis on the new files? O
Here is some additional information that I hope helps:
Operating system: Mac OS Mojave (10.14.4)
Matplotlib version: 2.2.4 (installed from pip)
Python version: 2.7.16
For automatic file detection, I used the watchdog library for python.
Can you post a minimal example of your code? The details are going to matter on this one, and I'm going to guess it's important how you're spawning program.py and where you're importing matplotlib.
@shirkan Thank you for the reply. Though it seems like I can't solve the problem by simply starting a new process unfortunately, I would keep trying. Thanks!
I encountered the same issue when trying to save a figure in matplotlib (script was called from a Flask app.py file. Others seems to have had the issue using Flask and calling another python script that saves a matplotlib image)
If you are running a webserver and using it to save Matplotlib make sure to set the backend to a non-interactive one (matplotlib.use('agg') or matplotlib.pyplot.switch_backend('Agg')) so that your server does not try to create (and then destroy) GUI windows that will never be seen (or if they are will be more of a nuisance).
Reacted by Yi Lin Tsai , X. Huang, Umut Seven, Sihang Qiu, abawchen, Chuan Yang, mhhsu, mamikon88, Sachin Kalsi, Imran Khan and 101 more
Reacted by GHERRI Walid, Peter, victor-paltz, TuanAnh Nguyen, Lety Cruz, myRcnn, Aarav Borthakur, mpolyakowa, Alwi Muhammad, JB0925 and 5 more
Reacted by Brandon Abbasspour, Chuan Yang, Roman Mirzoyan, mamikon88, Sachin Kalsi, Wojciech Łukasiewicz, Imran Khan, Matic Conradi, Hugo Palmer, Shashank Srivastav and 24 more
Reacted by Sachin Kalsi, Matic Conradi, Drew, Hugo Palmer, Bradley, Jennifer Paul, Jivan Roquet, GHERRI Walid, Raja CSP, Purvi Trivedi and 27 more
Reacted by Eg, KarinElimelech, Velizar Shulev, victor-paltz, TuanAnh Nguyen, Lety Cruz, Gabriel, myRcnn, Alwi Muhammad, JB0925 and 5 more
Reacted by GHERRI Walid, victor-paltz, TuanAnh Nguyen, myRcnn, JB0925, Kpllan and Solomon
@tacaswell yes, I came to that solution too. It works now! (It might be nice to have some check in matplotlib so that it doesn't crash the kernel when faced with that situation) edit: I see there is a pull request for it :) :)
I can't seem to find out how to get the work around (matplotlib.use('agg') or pyplot.switch_backend('Agg')) to work with mpl_toolkits.mplot3d import Axes3D.
My guess is the ability to drag the plot in 3D means there's something being loaded, or it doesn't respect the mode being changed.
Anyway, not sure if this repository is where to post (my guess is mpl_toolkits.mplot3d is a third-party extension) but it seemed worth posting.
Just close pylap adter creating svg
xticks(c, df['Month'])
bar([], 0)
bar(m, df['Earn'], width=0.5, color="#91eb87", label="Earn")
bar(c, df['Spend'], width=0.5, color="#eb879c", label="Spend")
legend()
axis([0, 10, 0, 100])
savefig('barchart.png')
# close it to avoid web server crush
pylap.close()
If you are running a webserver and using it to save Matplotlib make sure to set the backend to a non-interactive one (matplotlib.use('agg') or matplotlib.pyplot.switch_backend('Agg')) so that your server does not try to create (and then destroy) GUI windows that will never be seen (or if they are will be more of a nuisance).
I had the same issue. Your solution solved the issue. Thanks!
Activity
dopplershift commented on Jun 7, 2019
Can you post a minimal example of your code? The details are going to matter on this one, and I'm going to guess it's important how you're spawning program.py and where you're importing matplotlib.
Yusuke196 commented on Aug 11, 2019
Hi, I encountered a similar error. Please let me share it because I don't know how to solve it.
Because I had cloned the code from a repository on GitHub, you can probably reproduce the error situation by following procedures.
Thank you.
2019-08-11 16:04:29.458 python[1234:15965] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSWindow drag regions should only be invalidated on the Main Thread!'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff3ba2e2fd __exceptionPreprocess + 256
1 libobjc.A.dylib 0x00007fff660fba17 objc_exception_throw + 48
2 CoreFoundation 0x00007fff3ba47e59 -[NSException raise] + 9
3 AppKit 0x00007fff38fee5ca -[NSWindow(NSWindow_Theme) _postWindowNeedsToResetDragMarginsUnlessPostingDisabled] + 317
4 AppKit 0x00007fff38feb9f7 -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 1479
5 AppKit 0x00007fff38feb42a -[NSWindow initWithContentRect:styleMask:backing:defer:] + 45
6 _macosx.cpython-36m-darwin.so 0x0000000112c8b6b0 -[Window initWithContentRect:styleMask:backing:defer:withManager:] + 80
7 _macosx.cpython-36m-darwin.so 0x0000000112c8ebc7 FigureManager_init + 327
8 python 0x0000000105ad292c wrap_init + 12
9 python 0x0000000105a6b511 _PyObject_FastCallDict + 321
10 python 0x0000000105a862ee wrapperdescr_call + 206
11 python 0x0000000105a6b511 _PyObject_FastCallDict + 321
12 python 0x0000000105b4a2b2 call_function + 466
13 python 0x0000000105b472d2 _PyEval_EvalFrameDefault + 25458
14 python 0x0000000105b4bcb6 _PyFunction_FastCallDict + 998
15 python 0x0000000105a6b486 _PyObject_FastCallDict + 182
16 python 0x0000000105a6b61c _PyObject_Call_Prepend + 156
17 python 0x0000000105a6b2c5 PyObject_Call + 101
18 python 0x0000000105ad289f slot_tp_init + 159
19 python 0x0000000105ace894 type_call + 292
20 python 0x0000000105a6b511 _PyObject_FastCallDict + 321
21 python 0x0000000105b4a2b2 call_function + 466
22 python 0x0000000105b472d2 _PyEval_EvalFrameDefault + 25458
23 python 0x0000000105b4b7d9 fast_function + 569
24 python 0x0000000105b4a309 call_function + 553
25 python 0x0000000105b472d2 _PyEval_EvalFrameDefault + 25458
26 python 0x0000000105b4af23 _PyEval_EvalCodeWithName + 2883
27 python 0x0000000105b4bb2b _PyFunction_FastCallDict + 603
28 python 0x0000000105a6b486 _PyObject_FastCallDict + 182
29 python 0x0000000105a6b61c _PyObject_Call_Prepend + 156
30 python 0x0000000105a6b2c5 PyObject_Call + 101
31 python 0x0000000105b474cb _PyEval_EvalFrameDefault + 25963
32 python 0x0000000105b4af23 _PyEval_EvalCodeWithName + 2883
33 python 0x0000000105b4b73b fast_function + 411
34 python 0x0000000105b4a309 call_function + 553
35 python 0x0000000105b47365 _PyEval_EvalFrameDefault + 25605
36 python 0x0000000105b4b7d9 fast_function + 569
37 python 0x0000000105b4a309 call_function + 553
38 python 0x0000000105b472d2 _PyEval_EvalFrameDefault + 25458
39 python 0x0000000105b4af23 _PyEval_EvalCodeWithName + 2883
40 python 0x0000000105b40f17 PyEval_EvalCodeEx + 55
41 python 0x0000000105a96c0f function_call + 351
42 python 0x0000000105a6b2c5 PyObject_Call + 101
43 python 0x0000000105b474cb _PyEval_EvalFrameDefault + 25963
44 python 0x0000000105b4b7d9 fast_function + 569
45 python 0x0000000105b4a309 call_function + 553
46 python 0x0000000105b472d2 _PyEval_EvalFrameDefault + 25458
47 python 0x0000000105b4af23 _PyEval_EvalCodeWithName + 2883
48 python 0x0000000105b4b73b fast_function + 411
49 python 0x0000000105b4a309 call_function + 553
50 python 0x0000000105b472d2 _PyEval_EvalFrameDefault + 25458
51 python 0x0000000105b4bcb6 _PyFunction_FastCallDict + 998
52 python 0x0000000105a6b486 _PyObject_FastCallDict + 182
53 python 0x0000000105a6b61c _PyObject_Call_Prepend + 156
54 python 0x0000000105a6b2c5 PyObject_Call + 101
55 python 0x0000000105ad1979 slot_tp_call + 153
56 python 0x0000000105a6b511 _PyObject_FastCallDict + 321
57 python 0x0000000105b4a2b2 call_function + 466
58 python 0x0000000105b472d2 _PyEval_EvalFrameDefault + 25458
59 python 0x0000000105b4af23 _PyEval_EvalCodeWithName + 2883
60 python 0x0000000105b4b73b fast_function + 411
61 python 0x0000000105b4a309 call_function + 553
62 python 0x0000000105b472d2 _PyEval_EvalFrameDefault + 25458
63 python 0x0000000105b4bcb6 _PyFunction_FastCallDict + 998
64 python 0x0000000105a6b486 _PyObject_FastCallDict + 182
65 python 0x0000000105a6b61c _PyObject_Call_Prepend + 156
66 python 0x0000000105a6b2c5 PyObject_Call + 101
67 python 0x0000000105ad1979 slot_tp_call + 153
68 python 0x0000000105a6b511 _PyObject_FastCallDict + 321
69 python 0x0000000105b4a2b2 call_function + 466
70 python 0x0000000105b472d2 _PyEval_EvalFrameDefault + 25458
71 python 0x0000000105b4af23 _PyEval_EvalCodeWithName + 2883
72 python 0x0000000105b4b73b fast_function + 411
73 python 0x0000000105b4a309 call_function + 553
74 python 0x0000000105b472d2 _PyEval_EvalFrameDefault + 25458
75 python 0x0000000105b4bcb6 _PyFunction_FastCallDict + 998
76 python 0x0000000105a6b486 _PyObject_FastCallDict + 182
77 python 0x0000000105a6b61c _PyObject_Call_Prepend + 156
78 python 0x0000000105a6b2c5 PyObject_Call + 101
79 python 0x0000000105ad1979 slot_tp_call + 153
80 python 0x0000000105a6b511 _PyObject_FastCallDict + 321
81 python 0x0000000105b4a2b2 call_function + 466
82 python 0x0000000105b472d2 _PyEval_EvalFrameDefault + 25458
83 python 0x0000000105b4af23 _PyEval_EvalCodeWithName + 2883
84 python 0x0000000105b4b73b fast_function + 411
85 python 0x0000000105b4a309 call_function + 553
86 python 0x0000000105b472d2 _PyEval_EvalFrameDefault + 25458
87 python 0x0000000105b4bcb6 _PyFunction_FastCallDict + 998
88 python 0x0000000105a6b486 _PyObject_FastCallDict + 182
89 python 0x0000000105a6b61c _PyObject_Call_Prepend + 156
90 python 0x0000000105a6b2c5 PyObject_Call + 101
91 python 0x0000000105ad1979 slot_tp_call + 153
92 python 0x0000000105a6b511 _PyObject_FastCallDict + 321
93 python 0x0000000105b4a2b2 call_function + 466
94 python 0x0000000105b472d2 _PyEval_EvalFrameDefault + 25458
95 python 0x0000000105b4af23 _PyEval_EvalCodeWithName + 2883
96 python 0x0000000105b4b73b fast_function + 411
97 python 0x0000000105b4a309 call_function + 553
98 python 0x0000000105b472d2 _PyEval_EvalFrameDefault + 25458
99 python 0x0000000105b4bcb6 _PyFunction_FastCallDict + 998
100 python 0x0000000105a6b486 _PyObject_FastCallDict + 182
101 python 0x0000000105a6b61c _PyObject_Call_Prepend + 156
102 python 0x0000000105a6b2c5 PyObject_Call + 101
103 python 0x0000000105ad1979 slot_tp_call + 153
104 python 0x0000000105a6b511 _PyObject_FastCallDict + 321
105 python 0x0000000105b4a2b2 call_function + 466
106 python 0x0000000105b472d2 _PyEval_EvalFrameDefault + 25458
107 python 0x0000000105b4af23 _PyEval_EvalCodeWithName + 2883
108 python 0x0000000105b4b73b fast_function + 411
109 python 0x0000000105b4a309 call_function + 553
110 python 0x0000000105b472d2 _PyEval_EvalFrameDefault + 25458
111 python 0x0000000105b4bcb6 _PyFunction_FastCallDict + 998
112 python 0x0000000105a6b486 _PyObject_FastCallDict + 182
113 python 0x0000000105a6b61c _PyObject_Call_Prepend + 156
114 python 0x0000000105a6b2c5 PyObject_Call + 101
115 python 0x0000000105ad1979 slot_tp_call + 153
116 python 0x0000000105a6b511 _PyObject_FastCallDict + 321
117 python 0x0000000105b4a2b2 call_function + 466
118 python 0x0000000105b472d2 _PyEval_EvalFrameDefault + 25458
119 python 0x0000000105b4af23 _PyEval_EvalCodeWithName + 2883
120 python 0x0000000105b4b73b fast_function + 411
121 python 0x0000000105b4a309 call_function + 553
122 python 0x0000000105b472d2 _PyEval_EvalFrameDefault + 25458
123 python 0x0000000105b4bcb6 _PyFunction_FastCallDict + 998
124 python 0x0000000105a6b486 _PyObject_FastCallDict + 182
125 python 0x0000000105a6b61c _PyObject_Call_Prepend + 156
126 python 0x0000000105a6b2c5 PyObject_Call + 101
127 python 0x0000000105ad1979 slot_tp_call + 153
128 python 0x0000000105a6b511 _PyObject_FastCallDict + 321
129 python 0x0000000105b4a2b2 call_function + 466
130 python 0x0000000105b472d2 _PyEval_EvalFrameDefault + 25458
131 python 0x0000000105b4af23 _PyEval_EvalCodeWithName + 2883
132 python 0x0000000105b4b73b fast_function + 411
133 python 0x0000000105b4a309 call_function + 553
134 python 0x0000000105b472d2 _PyEval_EvalFrameDefault + 25458
135 python 0x0000000105b4b7d9 fast_function + 569
136 python 0x0000000105b4a309 call_function + 553
137 python 0x0000000105b472d2 _PyEval_EvalFrameDefault + 25458
138 python 0x0000000105b4bcb6 _PyFunction_FastCallDict + 998
139 python 0x0000000105a6b486 _PyObject_FastCallDict + 182
140 python 0x0000000105a6b61c _PyObject_Call_Prepend + 156
141 python 0x0000000105a6b2c5 PyObject_Call + 101
142 python 0x0000000105ad1979 slot_tp_call + 153
143 python 0x0000000105a6b511 _PyObject_FastCallDict + 321
144 python 0x0000000105b4a2b2 call_function + 466
145 python 0x0000000105b472d2 _PyEval_EvalFrameDefault + 25458
146 python 0x0000000105b4af23 _PyEval_EvalCodeWithName + 2883
147 python 0x0000000105b4bb2b _PyFunction_FastCallDict + 603
148 python 0x0000000105a6b486 _PyObject_FastCallDict + 182
149 python 0x0000000105a6b61c _PyObject_Call_Prepend + 156
150 python 0x0000000105a6b2c5 PyObject_Call + 101
151 python 0x0000000105ad1979 slot_tp_call + 153
152 python 0x0000000105a6b511 _PyObject_FastCallDict + 321
153 python 0x0000000105b4a2b2 call_function + 466
154 python 0x0000000105b472d2 _PyEval_EvalFrameDefault + 25458
155 python 0x0000000105b4b7d9 fast_function + 569
156 python 0x0000000105b4a309 call_function + 553
157 python 0x0000000105b472d2 _PyEval_EvalFrameDefault + 25458
158 python 0x0000000105b4b7d9 fast_function + 569
159 python 0x0000000105b4a309 call_function + 553
160 python 0x0000000105b472d2 _PyEval_EvalFrameDefault + 25458
161 python 0x0000000105b4b7d9 fast_function + 569
162 python 0x0000000105b4a309 call_function + 553
163 python 0x0000000105b472d2 _PyEval_EvalFrameDefault + 25458
164 python 0x0000000105b4bcb6 _PyFunction_FastCallDict + 998
165 python 0x0000000105a6b486 _PyObject_FastCallDict + 182
166 python 0x0000000105a6b61c _PyObject_Call_Prepend + 156
167 python 0x0000000105a6b2c5 PyObject_Call + 101
168 python 0x0000000105ad289f slot_tp_init + 159
169 python 0x0000000105ace894 type_call + 292
170 python 0x0000000105a6b511 _PyObject_FastCallDict + 321
171 python 0x0000000105b4a2b2 call_function + 466
172 python 0x0000000105b472d2 _PyEval_EvalFrameDefault + 25458
173 python 0x0000000105b4b7d9 fast_function + 569
174 python 0x0000000105b4a309 call_function + 553
175 python 0x0000000105b472d2 _PyEval_EvalFrameDefault + 25458
176 python 0x0000000105b4bcb6 _PyFunction_FastCallDict + 998
177 python 0x0000000105a6b486 _PyObject_FastCallDict + 182
178 python 0x0000000105a6b61c _PyObject_Call_Prepend + 156
179 python 0x0000000105a6b2c5 PyObject_Call + 101
180 python 0x0000000105b474cb _PyEval_EvalFrameDefault + 25963
181 python 0x0000000105b4b7d9 fast_function + 569
182 python 0x0000000105b4a309 call_function + 553
183 python 0x0000000105b472d2 _PyEval_EvalFrameDefault + 25458
184 python 0x0000000105b4b7d9 fast_function + 569
185 python 0x0000000105b4a309 call_function + 553
186 python 0x0000000105b472d2 _PyEval_EvalFrameDefault + 25458
187 python 0x0000000105b4bcb6 _PyFunction_FastCallDict + 998
188 python 0x0000000105a6b486 _PyObject_FastCallDict + 182
189 python 0x0000000105a6b61c _PyObject_Call_Prepend + 156
190 python 0x0000000105a6b2c5 PyObject_Call + 101
191 python 0x0000000105b99f36 t_bootstrap + 70
192 python 0x0000000105b92899 pythread_wrapper + 25
193 libsystem_pthread.dylib 0x00007fff67abd2eb _pthread_body + 126
194 libsystem_pthread.dylib 0x00007fff67ac0249 _pthread_start + 66
195 libsystem_pthread.dylib 0x00007fff67abc40d thread_start + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException
shirkan commented on Aug 11, 2019
I came across this problem too, what I do is simply run the graph code on a new process. Hope that helps.
Yusuke196 commented on Aug 11, 2019
@shirkan Thank you for the reply. Though it seems like I can't solve the problem by simply starting a new process unfortunately, I would keep trying. Thanks!
timforr commented on Oct 23, 2019
I encountered the same issue when trying to save a figure in matplotlib (script was called from a Flask app.py file. Others seems to have had the issue using Flask and calling another python script that saves a matplotlib image)
Python[55816:5412180] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSWindow drag regions should only be invalidated on the Main Thread!'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff44cca2fd __exceptionPreprocess + 256
1 libobjc.A.dylib 0x00007fff6f39aa17 objc_exception_throw + 48
2 CoreFoundation 0x00007fff44ce3e59 -[NSException raise] + 9
3 AppKit 0x00007fff4228a5ca -[NSWindow(NSWindow_Theme) _postWindowNeedsToResetDragMarginsUnlessPostingDisabled] + 317
4 AppKit 0x00007fff422879f7 -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 1479
5 AppKit 0x00007fff4228742a -[NSWindow initWithContentRect:styleMask:backing:defer:] + 45
6 _macosx.cpython-37m-darwin.so 0x00000001359d96b0 -[Window initWithContentRect:styleMask:backing:defer:withManager:] + 80
7 _macosx.cpython-37m-darwin.so 0x00000001359dcbc7 FigureManager_init + 327
8 Python 0x000000010a9e800f wrap_init + 12
9 Python 0x000000010a9af5f9 wrapperdescr_call + 337
10 Python 0x000000010a9a9918 _PyObject_FastCallKeywords + 358
11 Python 0x000000010aa3eef0 call_function + 746
12 Python 0x000000010aa37c70 _PyEval_EvalFrameDefault + 6421
13 Python 0x000000010a9a9e8c function_code_fastcall + 112
14 Python 0x000000010a9aa829 _PyObject_Call_Prepend + 150
15 Python 0x000000010a9e7f7d slot_tp_init + 80
16 Python 0x000000010a9e4c20 type_call + 172
17 Python 0x000000010a9a9918 _PyObject_FastCallKeywords + 358
18 Python 0x000000010aa3eef0 call_function + 746
19 Python 0x000000010aa37c70 _PyEval_EvalFrameDefault + 6421
20 Python 0x000000010a9a9e8c function_code_fastcall + 112
21 Python 0x000000010aa3eef7 call_function + 753
22 Python 0x000000010aa37c70 _PyEval_EvalFrameDefault + 6421
23 Python 0x000000010aa3f7a6 _PyEval_EvalCodeWithName + 1870
24 Python 0x000000010a9a96e5 _PyFunction_FastCallDict + 441
25 Python 0x000000010a9aa829 _PyObject_Call_Prepend + 150
26 Python 0x000000010a9a9bbf PyObject_Call + 136
27 Python 0x000000010aa37f43 _PyEval_EvalFrameDefault + 7144
28 Python 0x000000010aa3f7a6 _PyEval_EvalCodeWithName + 1870
29 Python 0x000000010a9a9a77 _PyFunction_FastCallKeywords + 225
30 Python 0x000000010aa3eef7 call_function + 753
31 Python 0x000000010aa37d0b _PyEval_EvalFrameDefault + 6576
32 Python 0x000000010a9a9e8c function_code_fastcall + 112
33 Python 0x000000010aa3eef7 call_function + 753
34 Python 0x000000010aa37d0b _PyEval_EvalFrameDefault + 6576
35 Python 0x000000010aa3f7a6 _PyEval_EvalCodeWithName + 1870
36 Python 0x000000010a9a9a77 _PyFunction_FastCallKeywords + 225
37 Python 0x000000010aa3eef7 call_function + 753
38 Python 0x000000010aa37c70 _PyEval_EvalFrameDefault + 6421
39 Python 0x000000010aa3f7a6 _PyEval_EvalCodeWithName + 1870
40 Python 0x000000010a9a9a77 _PyFunction_FastCallKeywords + 225
41 Python 0x000000010aa3eef7 call_function + 753
42 Python 0x000000010aa37c70 _PyEval_EvalFrameDefault + 6421
43 Python 0x000000010a9a9e8c function_code_fastcall + 112
44 Python 0x000000010aa3eef7 call_function + 753
45 Python 0x000000010aa37d0b _PyEval_EvalFrameDefault + 6576
46 Python 0x000000010a9a9e8c function_code_fastcall + 112
47 Python 0x000000010aa3eef7 call_function + 753
48 Python 0x000000010aa37d0b _PyEval_EvalFrameDefault + 6576
49 Python 0x000000010a9a9e8c function_code_fastcall + 112
50 Python 0x000000010aa37f43 _PyEval_EvalFrameDefault + 7144
51 Python 0x000000010aa3f7a6 _PyEval_EvalCodeWithName + 1870
52 Python 0x000000010a9a96e5 _PyFunction_FastCallDict + 441
53 Python 0x000000010aa37f43 _PyEval_EvalFrameDefault + 7144
54 Python 0x000000010a9a9e8c function_code_fastcall + 112
55 Python 0x000000010aa3eef7 call_function + 753
56 Python 0x000000010aa37c57 _PyEval_EvalFrameDefault + 6396
57 Python 0x000000010a9a9e8c function_code_fastcall + 112
58 Python 0x000000010aa3eef7 call_function + 753
59 Python 0x000000010aa37c57 _PyEval_EvalFrameDefault + 6396
60 Python 0x000000010a9a9e8c function_code_fastcall + 112
61 Python 0x000000010aa3eef7 call_function + 753
62 Python 0x000000010aa37c57 _PyEval_EvalFrameDefault + 6396
63 Python 0x000000010a9a9e8c function_code_fastcall + 112
64 Python 0x000000010a9aa829 _PyObject_Call_Prepend + 150
65 Python 0x000000010a9e7583 slot_tp_call + 71
66 Python 0x000000010a9a9918 _PyObject_FastCallKeywords + 358
67 Python 0x000000010aa3eef0 call_function + 746
68 Python 0x000000010aa37c70 _PyEval_EvalFrameDefault + 6421
69 Python 0x000000010a9b5567 gen_send_ex + 244
70 Python 0x000000010aa3747c _PyEval_EvalFrameDefault + 4385
71 Python 0x000000010aa3f7a6 _PyEval_EvalCodeWithName + 1870
72 Python 0x000000010a9a9a77 _PyFunction_FastCallKeywords + 225
73 Python 0x000000010aa3eef7 call_function + 753
74 Python 0x000000010aa37d0b _PyEval_EvalFrameDefault + 6576
75 Python 0x000000010aa3f7a6 _PyEval_EvalCodeWithName + 1870
76 Python 0x000000010a9a9a77 _PyFunction_FastCallKeywords + 225
77 Python 0x000000010aa3eef7 call_function + 753
78 Python 0x000000010aa37c57 _PyEval_EvalFrameDefault + 6396
79 Python 0x000000010a9a9e8c function_code_fastcall + 112
80 Python 0x000000010aa3eef7 call_function + 753
81 Python 0x000000010aa37c57 _PyEval_EvalFrameDefault + 6396
82 Python 0x000000010a9a9e8c function_code_fastcall + 112
83 Python 0x000000010aa3eef7 call_function + 753
84 Python 0x000000010aa37c70 _PyEval_EvalFrameDefault + 6421
85 Python 0x000000010a9a9e8c function_code_fastcall + 112
86 Python 0x000000010aa3eef7 call_function + 753
87 Python 0x000000010aa37c57 _PyEval_EvalFrameDefault + 6396
88 Python 0x000000010a9a9e8c function_code_fastcall + 112
89 Python 0x000000010a9aa829 _PyObject_Call_Prepend + 150
90 Python 0x000000010a9e7f7d slot_tp_init + 80
91 Python 0x000000010a9e4c20 type_call + 172
92 Python 0x000000010a9a9918 _PyObject_FastCallKeywords + 358
93 Python 0x000000010aa3eef0 call_function + 746
94 Python 0x000000010aa37c70 _PyEval_EvalFrameDefault + 6421
95 Python 0x000000010a9a9e8c function_code_fastcall + 112
96 Python 0x000000010aa3eef7 call_function + 753
97 Python 0x000000010aa37c57 _PyEval_EvalFrameDefault + 6396
98 Python 0x000000010a9a9e8c function_code_fastcall + 112
99 Python 0x000000010a9aa829 _PyObject_Call_Prepend + 150
100 Python 0x000000010a9a9bbf PyObject_Call + 136
101 Python 0x000000010aa37f43 _PyEval_EvalFrameDefault + 7144
102 Python 0x000000010a9a9e8c function_code_fastcall + 112
103 Python 0x000000010aa3eef7 call_function + 753
104 Python 0x000000010aa37c57 _PyEval_EvalFrameDefault + 6396
105 Python 0x000000010a9a9e8c function_code_fastcall + 112
106 Python 0x000000010aa3eef7 call_function + 753
107 Python 0x000000010aa37c57 _PyEval_EvalFrameDefault + 6396
108 Python 0x000000010a9a9e8c function_code_fastcall + 112
109 Python 0x000000010a9aa829 _PyObject_Call_Prepend + 150
110 Python 0x000000010a9a9bbf PyObject_Call + 136
111 Python 0x000000010aaa6261 t_bootstrap + 71
112 Python 0x000000010aa6ce95 pythread_wrapper + 25
113 libsystem_pthread.dylib 0x00007fff70d5c2eb _pthread_body + 126
114 libsystem_pthread.dylib 0x00007fff70d5f249 _pthread_start + 66
115 libsystem_pthread.dylib 0x00007fff70d5b40d thread_start + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException
tacaswell commented on Oct 24, 2019
If you are running a webserver and using it to save Matplotlib make sure to set the backend to a non-interactive one (matplotlib.use('agg') or matplotlib.pyplot.switch_backend('Agg')) so that your server does not try to create (and then destroy) GUI windows that will never be seen (or if they are will be more of a nuisance).
andy6804tw commented on Oct 24, 2019
@tacaswell thx~ I have same problem. It work!
timforr commented on Oct 24, 2019
@tacaswell yes, I came to that solution too. It works now! (It might be nice to have some check in matplotlib so that it doesn't crash the kernel when faced with that situation) edit: I see there is a pull request for it :) :)
Ensure that noninteractive backend is used for matplotlib
Halopend commented on Feb 23, 2020
I can't seem to find out how to get the work around (matplotlib.use('agg') or pyplot.switch_backend('Agg')) to work with mpl_toolkits.mplot3d import Axes3D.
My guess is the ability to drag the plot in 3D means there's something being loaded, or it doesn't respect the mode being changed.
Anyway, not sure if this repository is where to post (my guess is mpl_toolkits.mplot3d is a third-party extension) but it seemed worth posting.
jklymak commented on Feb 23, 2020
@Halopend can you open a new issue with all the recant info. This is the right place to report mplot3d issues
Aibier commented on May 19, 2020
Just close pylap adter creating svg xticks(c, df['Month']) bar([], 0) bar(m, df['Earn'], width=0.5, color="#91eb87", label="Earn") bar(c, df['Spend'], width=0.5, color="#eb879c", label="Spend") legend() axis([0, 10, 0, 100]) savefig('barchart.png') # close it to avoid web server crush pylap.close()Sameerpython commented on Jan 17, 2023
I had the same issue. Your solution solved the issue. Thanks!