我在python中使用子进程拒绝了Errno 13 Permission

wDr*_*ter 3 python error-handling bash hadoop apache-pig

问题的关键是

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 
Run Code Online (Sandbox Code Playgroud)

错误是.

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
Run Code Online (Sandbox Code Playgroud)

如果需要更多信息,请告诉我.任何帮助表示赞赏.谢谢.

Woo*_*ble 7

该错误表明/usr/share/java没有允许您执行它的权限,可能是因为它是一个目录,而不是一个可执行文件.

java在Ubuntu机器上找到可执行文件的位置(可能/usr/bin/java)并更改/usr/share/为指向正确的位置.