I'm having an error for what seems to be a permissions problem when trying to create a zip file in a specified folder testfolder
-folder has the following permissions: drwxr-xr-x 193 nobody nobody When trying to launch the following command in python I get the following:
p= subprocess.Popen(['7z','a','-pinfected','-y','/home/John/testfolder/yada.zip'] + ['test.txt'],stdout=PIPE.subprocess,stderr=PIPE.subprocess)
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python2.7/subprocess.py", line 710, in __init__ errread, errwrite) File "/usr/local/lib/python2.7/subprocess.py", line 1327, in _execute_child raise child_exception OSError: [Errno 13] Permission denied
Any idea what wrong with permissions?
I pretty new to it, my python runs from /usr/local/bin path
drwxr-xr-x
means that:
1] only the directory's owner can list its contents, create new files in it (elevated access) etc.,
2] members of the directory's group and other users can also list its contents, and have simple access to it.
So in fact you don't have to change the directory's permissions unless you know what you are doing, you could just run your script with sudo
like sudo python my_script.py
.
尝试更改文件夹的权限,然后查看是否再次出现:
chmod -R 777 /foldername
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.