When I try to download a media file through the django admin interface, I get this error:
OSError: [Errno 45] Operation not supported
Here is the last trace line:
File "/path/to/home/Envs/myenv/lib/python3.5/site-packages/django/core/files/locks.py", line 112, in unlock ret = fcntl.lockf(_fd(f), fcntl.LOCK_UN)
I found this answer , and one of the comments led me to this ticket , and then this commit , entered on the ticket as a "workaround" (see below).
Here is the change I have to make in django/core/files/locks.py
according to a workaround.
elif system_type == 'posix': def lock(file, flags): - fcntl.flock(fd(file), flags) + fcntl.lockf(fd(file), flags) def unlock(file): - fcntl.flock(fd(file), fcntl.LOCK_UN) + fcntl.lockf(fd(file), fcntl.LOCK_UN)
I tried manually undoing the changes from this commit (replacing flock()
calls with lockf()
calls, but I still get the same error. There are also patches there, but these patches seem old (~ 7 years old and I am using django 1.9 with python 3.5).
How can i solve this?
EDIT:
As mentioned in plombix, my home directory is installed on NFS.
EDIT2:
I also tried replacing flock calls with fcntl.fcntl()
calls, and I got another error:
OSError: [Errno 14] Bad address