问题描述
我设计了一个Python软件来从我的微控制器收集数据并进行实时绘图:
I have designed a Python software to collect data from my microcontroller and make live plots:
我的GUI中有十二个matplotlib动画(GUI是用PyQt设计的)。每个matplotlib动画连接到一个TCP线程,通过该链接接收浮点数。在接收到浮点数时,matplotlib动画向图中添加一个新点。而且huray,我们得到了活的地块!
I have twelve matplotlib animations in my GUI (the GUI is designed with PyQt). Each matplotlib animation is connected to one TCP thread, receiving floating point numbers through that link. Upon receiving a floating point number, the matplotlib animation adds a new point to the graph. And huray, we got live plots!
我的软件平稳运行了几秒钟(有时甚至半分钟)。然后发生灾难。 Windows提到Python已经停止工作。我甚至没有在我的终端窗口中打印出异常报告(通常会发生在我所有的其他错误)。 Windows询问我是否要调试Python应用程序,并建议使用Visual Basic。在Visual Basic中,我收到以下错误报告:
My software runs smoothly for a couple of seconds (sometimes up to half a minute). And then disaster strikes. Windows mentions "Python has stopped working". I don't even get an exception report printed in my terminal window (as it normally would happen for all my other bugs). Windows asks me if I want to debug the Python application, and suggests to use Visual Basic for that. In Visual Basic, I get the following error report:
Unhandled exception at 0x00007FFC596CE6FC (ntdll.dll) in
python.exe: 0xC0000374: A heap has been corrupted
(parameters: 0x00007FFC597222B0).
Unhandled exception at 0x00007FFC56071F28 in python.exe:
Microsoft C++ exception: std::bad_alloc at memory
location 0x0000003DBA30E8F0.
Exception thrown at 0x0000000000000000 in python.exe:
0xC0000005: Access violation executing location
0x0000000000000000.
我重新启动了一切,再试一次。再次发生灾难,我在Visual Basic中收到以下错误报告:
I restart everything, and try it once more. Disaster strikes again, and I get the following error report in Visual Basic:
Unhandled exception at 0x00000000660E8D61 (QtGui4.dll) in python.exe:
0xC0000005: Access violation reading location 0x0000000000000020.
再次重新启动另一个试用版。灾难再次袭击我:
Once again, I restart for another trial. Disaster hits me again:
Unhandled exception at 0x00007FFC596CE6FC (ntdll.dll) in python.exe:
0xC0000374: A heap has been corrupted (parameters: 0x00007FFC597222B0).
不幸的是,我不知道这些错误报告是什么意思。我已经搜索了 QtGui4.dll
和 ntdll.dll
。我找到几个程序来修复dll在我的电脑上,但诺顿防病毒告诉我,我不能相信他们。所以我现在不在了选择范围之内,而是转到StackOverflow作为我最后的手段。
Unfortunately, I have no clue what these error reports mean. I have googled QtGui4.dll
and ntdll.dll
. I found a couple of programs to fix dll's on my computer, but Norton antivirus tells me that I cannot trust them. So I'm out of options now, and turn to StackOverflow as my last resort.
提前感谢您的帮助。
编辑
:我已经按照您的建议,通过 matplotlib.use(Qt4Agg)更改matplotlib后端
,但没有帮助。
推荐答案
我相信这个问题现在已经解决了。这是问题的根本原因。我以线程不安全的方式从另一个线程访问了我的GUI(例如,活地图,LED,..)。该应用程序运行良好的一段时间(半分钟),但不可避免地会在稍后崩溃。
I believe that the issue is fixed now. This was the root cause of the problem. I accessed my GUI (for example the live plots, the LEDs, ..) from another thread, in a thread-unsafe way. The application works good for some time (half a minute), but inevitably crashes miserably later on.
我通过使用信号/插槽机制来修复它。这是如何(指向另一个StackOverflow问题的链接):
I fixed it through using the signal/slot mechanism. This is how (a link to another StackOverflow question):
很抱歉给您带来不便。
这篇关于由于ntdll.dll和QtGui4.dll,Python程序崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!