'Segmentation fault (core dumped) while using matplotlib python module

I am using matplotlib in a python script in order to create a pie chart, but facing the bellow issue while running it:

Segmentation fault (core dumped)

Even if I went through some related issue in StackOverflow, but didn't find something covering my testcase.

I am using python3.6, matplotlib: '3.3.2' and I am importing the modules as follows:

import matplotlib.backends
import matplotlib.figure
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
from matplotlib.font_manager import FontProperties

This is my code:

fig = matplotlib.figure.Figure(figsize=(4,4))
fig.set_facecolor('lightgrey')
ax = fig.add_subplot(111)
Found_over_Res = {}
for _asw in over_Res:
    if over_Res[_asw] != 0:
        Found_over_Res[_asw] = over_Res[_asw]
        ax.pie(Found_over_Res.values(), autopct='%1.1f%%')
        fontP = FontProperties()
        fontP.set_size('xx-small')
        ax.legend(Found_over_Res.keys(), loc='best', prop=fontP)
        overCanvas = FigureCanvasTkAgg(fig, master=_Tempo)
        overCanvas.get_tk_widget().grid(row=0, column=4)
        overCanvas.draw()

Don't know if I missed something, for that I am facing that error, anyone could support, that will be appreciated thanks!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source