On 11/19/21 10:38 AM, Mahmood Naderan wrote: >> And what is the result of plot()? Is it a valid object, or is it None? > > Well the error happens on the plot() line. I tried to print some information > like this: > <snipped incomplete code> > Any thoughts on that?
It's not really possible for us to know what is happening since none of us are in front of your computer with your code in front of us. I cannot run any of your posted code excerpts. The best way to get assistance here on the list is to create a minimal, self-contained, run-able, example program that you can post in its entirety here that demonstrates the issue. Otherwise all anyone can do is make guesses. Did you read through the exception message? It is providing a lot of information. The message is saying that matplotlib is trying to call .get_figure() on a self.axes list item, but that is not a valid object, but is None. The question is, why is that list full of Nones? Farther up the traceback it notes that on line 66 of process_csv.py, you make a call to plot_data() passing it the axes. Perhaps there's something wrong with the axes object or list you are passing in there. Did you print that out to make sure that df, cnt, and axes all contain valid things? All I can tell you is to use the standard debugging techniques you would use for any problem. Use either a debugger or print()'s to print out the contents and types of each variable to verify they contain the data you think they do. If you have nested function calls, break them out separately so you can examine the inputs and outputs of each of them. If necessary, trace your way through the matplotlib code, but almost certainly you'll find the problem is in bad data you are passing to matplotlib. -- https://mail.python.org/mailman/listinfo/python-list