-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Closed
Closed
Copy link
Labels
Difficulty: Mediumhttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issueshttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issues
Milestone
Description
When using the Agg driver, pickling fails with TypeError: cannot serialize '_io.BufferedWriter' object when printing a figure to PDF beforehand, such as illustrated below. I'm using Matplotlib 1.5.1 on Python 3.5.0. I installed Matlotlib through pip+virtualenv.
The failure is as follows:
In [1]: import matplotlib
In [2]: matplotlib.use("Agg")
In [3]: import matplotlib.pyplot
In [4]: (f, a) = matplotlib.pyplot.subplots()
In [5]: import pickle
In [6]: pickle.dump(f, open("/tmp/test1.pkl", "wb"))
In [7]: f.canvas.print_figure("/tmp/test.pdf")
In [8]: pickle.dump(f, open("/tmp/test2.pkl", "wb"))
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-8-368ac3899228> in <module>()
----> 1 pickle.dump(f, open("/tmp/test2.pkl", "wb"))
TypeError: cannot serialize '_io.BufferedWriter' object
In [9]: print(matplotlib.__version__)
1.5.1
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Difficulty: Mediumhttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issueshttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issues