6

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.

Wooble
  • 87,717
  • 12
  • 108
  • 131
wDroter
  • 1,209
  • 4
  • 17
  • 25
  • In addition to @Woobe's comments, `foo.txt` won't be where you expect it to be when you run that command; you should pass `foo.txt` and `fsFunc.pig` with their full path names. – Burhan Khalid Oct 02 '12 at 13:44
  • This program currently runs when executed from the server it is on. I am trying to get this to run on my Ubuntu desktop. foo.txt not existing is not a current issue, it is simply a placeholder for now. – wDroter Oct 02 '12 at 13:48

4 Answers4

10

The error indicates that /usr/share/java does not have permissions that will allow you to execute it, probably because it is a directory, not an executable.

Find the location of the java executable on your Ubuntu machine (probably /usr/bin/java) and change /usr/share/ to point to the right place.

Wooble
  • 87,717
  • 12
  • 108
  • 131
1

just type chmod -R 777 /your/project/

its works for my...

Tuki
  • 51
  • 1
  • 2
  • 4
    `chmod -R 777 /your/project/` makes everything in the project readable, editable, and executable by any users on the system. You are better off doing: `chmod -R +x /your/project/`. This just makes everything executable by any user on the system, or just finding the executable and doing `chmod +x executable` is better again. This improves security. – Jordan Stewart Jun 07 '19 at 03:01
0

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.

0

you could also try setting shell=True as the second argument in you subprocess.call(), that may work.

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 
bcosta12
  • 2,364
  • 16
  • 28
momaji
  • 161
  • 1
  • 6