# Reading Pickled file

**URL:** <https://forum.djangoproject.com/t/reading-pickled-file/5021>\
**Category:** Deployment\
**Created:** [October 30, 2020, 5:45pm UTC](https://forum.djangoproject.com/t/reading-pickled-file/5021 "2020-10-30T17:45:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ivvlko](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/ivvlko/32/2333_2.png) [@ivvlko](https://forum.djangoproject.com/u/ivvlko)\
**Post date:** [October 30, 2020, 5:45pm UTC](https://forum.djangoproject.com/t/reading-pickled-file/5021/1 "2020-10-30T17:45:12Z")

</div>

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 views.py 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

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [October 30, 2020, 10:16pm UTC](https://forum.djangoproject.com/t/reading-pickled-file/5021/2 "2020-10-30T22:16:25Z")

</div>

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.

Ken

---

<div class="post-metadata">

**Author:** ![jumashafara](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/jumashafara/32/10495_2.png) [@jumashafara](https://forum.djangoproject.com/u/jumashafara)\
**Post date:** [October 20, 2022, 12:44pm UTC](https://forum.djangoproject.com/t/reading-pickled-file/5021/3 "2022-10-20T12:44:13Z")

</div>

Thanks a lot, how do I then give Django permission?

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [October 20, 2022, 7:12pm UTC](https://forum.djangoproject.com/t/reading-pickled-file/5021/4 "2022-10-20T19:12:58Z")

</div>

It depends a lot upon the specifics of your deployment environment - how you’re running Django, what your directory structure may be, what UIDs / GIDs are involved, how those files are being created and copied to the site, etc, etc, etc.
