Reading Pickled file

Hello guys,

I’m trying to read pickled file - a ML model to be precise - but for some reason it raises:

FileNotFoundError: [Errno 2] No such file or directory:

I’m running pickle.load(open(‘filename.pickle’, ‘rb’)) in in one of the apps.

I have no problems reading it on Python Project and Jupyter Notebook but it raises exception in a Django project? ANy Ideas?

Thanks in advance

There are a couple of different possibilities here:

Your “current directory” in Django is not the directory where your code module resides. So referencing the name of the file without specifying the directory where it’s located could be causing this.

Or, depending upon how you have this deployed, if Django doesn’t have permissions to the file or the containing directory, that could also cause this.