title: Catching the exception thrown by python script in shell script
body: <p>I am having a shell script which opens a file and pass it to python script for processing it. So if there is any issue with the file ( e.g. the file content is not in the format required for the successful execution for python script), the python script throws an exception. Since my objective it to process N files using python script. I need to know which is the file causing the script to break.  I read on how to catch the exception in thrown by command execution. <a href="http://linuxcommand.org/wss0150.php" rel="noreferrer">http://linuxcommand.org/wss0150.php</a> . But in my case its the python script which throws the exception and I need to know in shell script what the exception has been thrown. Can anyone help me how can I proceed with this?</p>
  
  <p>Below is the code snippet :</p>
  
  <pre><code>#!/bin/bash
  yesterday=$(date --date "yesterday" "+%y%m%d")
  ftoday=$(date --date "today" "+%m-%d-%Y")
  year=$(date "+%Y")
  fileList=$(find C:/logdata/$year/$ftoday/ -iname "*"$yesterday".log")
  for var in $fileList
  do
  echo -e "\n START Processing File : $var" &gt;&gt; shelltestlog.txt
  cat $var| ./scriptA.py 
  echo -e "\n END Processing File : $var" &gt;&gt; shelltestlog.txt
  done
  </code></pre>