can't write to file in mod_wsgi app: permission denied
-
03-10-2019 - |
문제
I have a very simple mod_wsgi python application that tries to write to a file:
tempfile = open('temp.txt', 'w')
This fails with
IOError: [Errno 13] Permission denied: 'temp.txt'
The folder with myapp.wsgi has world-writable permissions (777). I can write to a file from a simple PHP test script. This is running on Mac OSX 10.6 Snow Leopard, so as far as I know, there are no additional protection mechanisms in place (SELinux, AppArmor, etc.).
Why are write permissions denied ?
해결책
Yep, the solution to the problem is to use full paths to spcify file locations (and, just to be on the safe side, to specify shell commands you might be using in system call (or popen) calls), as the $PATH might not be what you expect it).
제휴하지 않습니다 StackOverflow