[Flask] Simultaneous Matplotlib "QObject" error
John.Robson at usp.br
Fri Sep 9 17:26:13 EDT 2016
I found the main problem, I followed this and worked:
"matplotlib.use('Agg')" for not print, only save figures.
I also fixed other problems, I was using "plt.savefig", "plt.xxx" I
believe that this "plt" was harming other simultaneous plots, so I
replaced every "plt." by ".fig" and now I think is OK.
I just wonder how can I isolate each plot from other simultaneous plots,
I'm doing this:
fig = plt.figure()
ax = fig.gca()
> plot stuff, scatterplot, etc..., set title, lables, etc...
fig = ax.get_figure()
fig.savefig(filename, format='png', dpi=100, facecolor='w',
So the first "fig" instance is destroyed at the end and there is no
This is a good approach to isolate all plots?
On 09/08/16 21:13, John Robson wrote:
> Hi all,
> I have some pages that plot charts using Matplotlib, they work very
> well, but when running them simultaneously they break, with errors like:
> "QObject: Cannot create children for a parent that is in a different
> "QObject::~QObject: Timers cannot be stopped from another thread"
> I wonder how to safely use Matplolib with Flask (and several
> simultaneous users plotting stuff all the time)?
> Thank you,
More information about the Flask