I tried to read pickle file using Anaconda Navigator and have the following script.
import pickle
import sys, os
with open('pickle1', 'rb') as fp:
data_new = pickle.load(fp)
After running the window I get the following error window.
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-4-047bee0f1247> in <module>()
3
4 with open('pickle1', 'rb') as fp:
----> 5 data_new = pickle.load(fp)
ModuleNotFoundError: No module named 'Data'
Can you please help me fix this issue? I tried to rename file to *.pkl, and *.csv formats, but it did not help. Original data file has no extension of its own.
The program that created the pickle file did
import Data
and there are references to that module inside the pickled object. The program that loads the pickled object needs to be able to import that module to resolve those references. Either put the location of Data.py on your PYTHONPATH (or add the location tosys.path
), or copy the module to where your program can find it.