code: def call_external_subprocess(command_list,
                         stdin_filename=None, stdout_filename=None, stderr_filename=None,
                         env=None):
      
  
      if stdin_filename: stdin = open(stdin_filename, "r")
      else: stdin = None
      if stdout_filename: stdout = open(stdout_filename, "w")
      else: stdout = None
      if stderr_filename: stderr = open(stderr_filename, "w")
      else: stderr = None
  
      subprocess.check_call(command_list, stdin=stdin, stdout=stdout, stderr=stderr,
                            env=env)
  
      if stdin_filename: stdin.close()
      if stdout_filename: stdout.close()
      if stderr_filename: stderr.close()
  
      # The older way to do the above with os.system is below, just for reference.
      # command = " ".join(command_list)
      # if stdin_filename: command += " < " + stdin_filename
      # if stdout_filename: command += " > " + stdout_filename
      # if stderr_filename: command += " 2> " + stderr_filename
      # os.system(command)
      return
docs: Run the command and arguments in the command_list.  Will search the system
      PATH for commands to execute, but no shell is started.  Redirects any selected
      outputs to the given filename.  Waits for command completion.