Closed beijiguang94 closed 7 months ago
Thank you for contacting us. Can you please provide me with the file causing the error or provide steps to reproduce it?
The .pickle file is just a normal figure generated using the following code in a vscode terminal:
import pickle
import matplotlib.pyplot as plt
fig1 = plt.figure()
plt.plot([1,2], [1,2])
pickle.dump(fig1, open('test.pickle', 'wb'))
Then the file test.pickle can be loaded and the original figure can be shown again using code:
fig2 = pickle.load(open('test.pickle', 'rb'))
plt.show()
But clicking on the file test.pickle gives an error as in the title with the extension installed.
Thank you for bringing this to our attention. We are pleased to inform you that starting from version 0.0.12, we now offer support for displaying plt figures. Your feedback is highly appreciated.
For the example you mentioned:
Thanks. But it still reported the same error even if I had updated the version to 0.0.12. FYI, I use vscode + WSL 2 on Windows.
Based on your problem, I believe there are two potential solutions to consider.
Cause:
It appears that the version of matplotlib
on the system where you attempted to load the pickled figure was older than the version used to create the pickle file.
Approach 1:
Updating matplotlib
should resolve the issue.
Approach 2:
Perhaps you can try changing the extension setting to ensure consistency between the environment used to create the plt.figure
instance and the one used to view the pickle
file.
An illustration for modifying env for the extension:
I hope this is helpful. Let me know if you need any further assistance with anything.
Yes, approach 2 works. Thanks for pointing it out.
When I open a .pickle file, it only shows one line of error as the title above.