I am attempting to port my Django app to a python anywhere environment. This app contains pickled models which have dependencies. According to this stackoverflow post, "pickle doesn't actually store information about how a class/object is constructed, and needs access to the class when unpickling."
The solution given is to simply include the dependencies in the file where main is called. I was doing this on my local server by adding the following line at the top of my manage.py
file:
from NewsClassifier.modelTransformers import Cleaner, CountVectorizerWithStemming, SetBias, RemoveNan
However this solution doesn't work in the python anywhere environment as it seems __main__
is somewhere else. Can I somehow access this __main__
module? Or alternatively, is there a workaround to this problem?
Thanks!
EDIT:
Hyperlink doesn't seem to be working so heres the URL for the post: https://stackoverflow.com/questions/27732354/unable-to-load-files-using-pickle-and-multiple-modules