Getting an error when saving a matplotlib figure to a png file Follow
The stack is below. The code works fine when running from a notebook or from the command line. The error only shows up in PyCharm.
In PyCharm, I can save the plot in pdf fine and I can save a simpler plot in png,
Traceback (most recent call last):
File "/ABCD/env/venvs/latest/lib/python3.6/site-packages/matplotlib/backend_bases.py", line 2785, in _wait_cursor_for_draw_cm
File "/ABCD/env/venvs/latest/lib/python3.6/site-packages/matplotlib/backends/_backend_tk.py", line 544, in set_cursor
File "/usr/local/python/3.6.2/lib/python3.6/tkinter/__init__.py", line 1479, in configure
return self._configure('configure', cnf, kw)
File "/usr/local/python/3.6.2/lib/python3.6/tkinter/__init__.py", line 1470, in _configure
self.tk.call(_flatten((self._w, cmd)) + self._options(cnf))
_tkinter.TclError: invalid command name "."
Please sign in to leave a comment.
Did you use the same venv when ran the code in the system terminal?
Could you provide a code snippet that reproduces the issue?
I was able to solve the problem by saving the figure before showing the plot!