title: How to pass a bash parameter to a python script in a cron job?
body: <p>I have a python application that uses getopt() to parse the command line for parameters.  It works fine in an interactive bash shell, or in a bash script that is called from the command line, bit it will not execute when being called from within a bash shell script via cron.  I am using Fedora 15.</p>
  
  <p>The application fails when called as a cron job, issuing the following error in /var/log/messages:</p>
  
  <p><code>myscript.py: abrt: detected unhandled Python exception in myscript.py</code></p>
  
  <p>It seems that the command line parameters aren't being passed to the python script properly.</p>
  
  <p>For example, the following command line invocation works properly, setting the input filename to "input.txt" and setting the "log" and "timer" flags to their desired values:</p>
  
  <pre><code>python myscript.py -i input.txt --log --timer
  </code></pre>
  
  <p>When I attempt to invoke the program via a bash script at the command line, the bash script works fine.  But when I attempt to run the bash script via cron, execution fails with the aforementioned error.</p>
  
  <p>I am at a loss to determine why the shell script fails to execute properly via cron.  I am using full path names from within the bash script used for the cron job, so environment paths shouldn't be an issue:</p>
  
  <p><code>/usr/bin/python /path/to/myscript.py -i /path/to/input.txt --log --timer</code></p>
  
  <p>I am thinking that this syntax, when used in a bash script called via cron, might be passing the script's parameters to python, rather than to myscript.py.</p>
  
  <p>Any help would be appreciated!</p>