I already run my code to load my variable saved by pickle. This my code
import pickle
last_priors_file = open('simpanan/priors', 'rb')
priors = pickle.load(last_priors_file)
and i get error like this : AttributeError: Can't get attribute 'Wishart' on <module '__main__' from 'app.py'>
This happens because the pickled data was saved when the script is run as __name__ == '__main__'
and so it saves the location of Wishart
as __main__.Wishart
. Then, when you run your next script to load the data, there is no Wishart
in scope so it fails.
The fix in this case is to simply add from wherever import Wishart
before the call to pickle.load
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With