title: Can't execute shell script from python subprocess: permission denied
body: <p>Tried googling but couldn't find something that relates to my particular problem. I'm trying to run a shell script from python but the shell script wouldn't run because of a permission denied error. The python code I'm running is:</p>
  
  <pre><code>process = subprocess.Popen('run.sh', shell=True, stdout=subprocess.PIPE)
  process.wait()
  ....
  os.killpg(pro.pid, signal.SIGTERM)
  </code></pre>
  
  <p>The error I'm getting:</p>
  
  <pre><code>python RunScript.py "input"
  /bin/sh: 1: run.sh: Permission denied
  </code></pre>
  
  <p>The contents of my shell script is:</p>
  
  <pre><code>#!/bin/sh
  abspath=$(cd "$(dirname "$0")"; pwd)
  CLASSPATH=$CLASSPATH:$abspath/"lib/*":$abspath/"bin"
  export CLASSPATH
  java -classpath $CLASSPATH my.folder.path.Class $abspath/../data/data.txt $abspath/../data/data2.txt
  </code></pre>
  
  <p>Thanks in advance.</p>