Reputation: 473
I am trying to use memory_profiler but it is giving pickling error. In my code I am loading a object from a pickle file and the code is working fine but when I am running it with memory profiler it gives "'module' object has no attribute" error. Any suggestions?
Upvotes: 0
Views: 847
Reputation: 39
Use the import mechanism rather than invoking python -m memory_profiler
, ie.
from memory_profiler import profile
@profile
def func():
…
data = pickle.load(open('myfile', 'rb'))
…
I’m not able to give a clear explanation of why that works.
Upvotes: 1