我有一个 Errno 13 Permission denied with subprocess in python
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12691361/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
I have an Errno 13 Permission denied with subprocess in python
提问by wDroter
The line with the issue is
问题的重点是
ret=subprocess.call(shlex.split(cmd))
cmd = /usr/share/java -cp pig-hadoop-conf-Simpsons:lib/pig-0.8.1-cdh3u1-core.jar:lib/hadoop-core-0.20.2-cdh3u1.jar org.apache.pig.Main -param func=cat -param from =foo.txt -x mapreduce fsFunc.pig
The error is.
错误是。
File "./run_pig.py", line 157, in process
ret=subprocess.call(shlex.split(cmd))
File "/usr/lib/python2.7/subprocess.py", line 493, in call
return Popen(*popenargs, **kwargs).wait()
File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
raise child_exception
OSError: [Errno 13] Permission denied
Let me know if any more info is needed. Any help is appreciated. Thanks.
如果需要更多信息,请告诉我。任何帮助表示赞赏。谢谢。
采纳答案by Wooble
The error indicates that /usr/share/javadoes not have permissions that will allow you to execute it, probably because it is a directory, not an executable.
该错误表明/usr/share/java没有允许您执行它的权限,可能是因为它是一个目录,而不是一个可执行文件。
Find the location of the javaexecutable on your Ubuntu machine (probably /usr/bin/java) and change /usr/share/to point to the right place.
java在您的 Ubuntu 机器上找到可执行文件的位置(可能/usr/bin/java)并更改/usr/share/为指向正确的位置。
回答by wDroter
That's an OS permissions error. It means your user doesn't have permission to write to that directory/file. It's nothing to do with Python.
这是操作系统权限错误。这意味着您的用户无权写入该目录/文件。这与 Python 无关。
回答by Tuki
just type chmod -R 777 /your/project/
只需输入 chmod -R 777 /your/project/
its works for my...
它适用于我的...
回答by momaji
you could also try setting shell=True as the second argument in you subprocess.call(), that may work.
您也可以尝试将 shell=True 设置为 subprocess.call() 中的第二个参数,这可能会起作用。
ret = subprocess.call(shlex.split(cmd), shell=True)
cmd = /usr/share/java -cp pig-hadoop-conf-Simpsons:lib/pig-0.8.1-cdh3u1-core.jar:lib/hadoop-core-0.20.2-cdh3u1.jar org.apache.pig.Main -param func=cat -param from =foo.txt -x mapreduce fsFunc.pig

