'PermissionError: [Errno 13] Permission denied in Django
I have encountered a very strange problem.
I'm working with django, I create a directory on server, and try to save pickle file into it, this way:
with open(path, 'wb') as output:
pickle.dump(obj, output, pickle.HIGHEST_PROTOCOL)
And get:
PermissionError: [Errno 13] Permission denied
I tried to give all permissions to this directory, this way:
os.chmod(save_full_path, stat.S_IWOTH | stat.S_IWUSR | stat.S_IWGRP)
but this didn't help.
Although directory seems to have all permissions(0o777), I still get this error.
By the way, I have no problems with saving uploaded files to this directory.
I'm very new to django, I would really appreciate if someone explained me what am I doing wrong.
Solution 1:[1]
It seems like i have figured out this myself. Found this question, and did excactly what is written there.
Permission denied when trying to write to file from a view
But I still don't know what was the problem in my case :(
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Olja Muravjova |
