I have designed a Python software to collect data from my microcontroller and make live plots:
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!
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.
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).
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.
Thanks in advance for your help.
EDIT
: I have followed your advice to change the matplotlib backend through matplotlib.use("Qt4Agg")
, but it didn't help.
matplotlib.use("Qt4Agg")
. Then I would try usingplt.pause
instead oftime.sleep
. – Cairns