How can I deactivate 'Warning: Source ID 510 was not found when attempting to remove it - GLib.source_remove(self._idle_event_id)'?

Martin Thoma picture Martin Thoma · Apr 9, 2015 · Viewed 10.5k times · Source

When I execute

#!/usr/bin/env python

import matplotlib.pyplot as plt

plt.plot([1, 2, 3, 4])
plt.show()

(and more complex examples) I get

/usr/local/lib/python3.4/dist-packages/
matplotlib/backends/backend_gtk3.py:215: Warning: 
Source ID 7 was not found when attempting to remove it
    GLib.source_remove(self._idle_event_id)

What causes this and how can I get rid of these warnings?

I know that I can use

import warnings
warnings.simplefilter("ignore")

to get rid of all warnings, but that is not what I am asking for. I want to have warnings, but none from matplotlib (especially the one from above).

Answer

elya5 picture elya5 · Apr 18, 2015

GLib.source_remove was not successful because the self.close_event() that was executed before probably already did the job.

This commit should fix your problem. It is from the 23rd February. You can either wait for the next release or apply the patch manually.