title: Python - CalledProcessError: Command '[...]' returned non-zero exit status 127
body: <p>I am working on a microservice using Bottle in Python, where I need to generate a PDF using a .tex file. I am using subprocess to generate the PDF but I keep getting the same error over and over again:</p>
  
  <pre><code>Traceback (most recent call last):
  File "/Users/casa/Desktop/tesisform/bottle.py", line 763, in _handle
  return route.call(**args)
  File "/Users/casa/Desktop/tesisform/bottle.py", line 1577, in wrapper
  rv = callback(*a, **ka)
  File "tesis.py", line 114, in tesis_form
  subprocess.check_call(["./runtex", texfname])
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 540, in check_call
  raise CalledProcessError(retcode, cmd)
  CalledProcessError: Command '['./runtex', u'111111']' returned non-zero exit status 127
  </code></pre>
  
  <p>I already tried all the solutions I found for the same error in Stackverflow, however none seem to solve my problem. My code is as follows</p>
  
  <pre><code>@route('/pdf')
  def tesis_form():
      actn = request.query.actn
      fname = "actas/"+actn + ".json"
      with open(fname,"r") as f:
          data = json.load(f)
      tex = template('tesis-evaluation-tex', data)
      tex = tex.encode('utf-8')
      texfname = "%s" % (actn)
      with open("tmp/"+actn+".tex","w") as f:
          f.write(tex)
      subprocess.check_call(["./runtex", texfname])
      return static_file(actn+".pdf", root='tmp')
  </code></pre>
  
  <p>And this is my runtex file</p>
  
  <pre><code>echo $1
  cd tmp
  pdflatex $1
  </code></pre>
  
  <p>Any help would be much appreciated</p>