title: Python script cannot find/see file when being executed through shell script
body: <p>I am trying to run a Python script, <code>postprocess.py</code>, through a shell script, <code>Allrun.sh</code>.</p>
  
  <p>It works fine when I execute the Python script manually, but I get an error when I run <code>Allrun.sh</code>. </p>
  
  <pre><code>#!/bin/bash
  # File: Allrun.sh 
  python postprocess.py
  </code></pre>
  
  <p>And here is the short segment of <code>postprocess.py</code> that the error is thrown for</p>
  
  <pre><code>   for files in os.listdir("."):
         if files.endswith(".stl"):
             STLfile = files
     f = open(STLfile,'r')
  </code></pre>
  
  <p>The error: </p>
  
  <blockquote>
    <p>line 797, in PostProcessing
        f = open(STLfile,'r') NameError: name 'STLfile' is not defined</p>
  </blockquote>
  
  <p>However, an <code>.stl</code> file does exist in the directory.</p>