title: Python script running successfully on command prompt but not in crontab
body: <p>I have written a python script.py in my ~home/ directory which calls other python scripts located ~home/bin. 
  When i run script.py i am able to run it successfully but when i schedule script.py in crontab, script.py is not able to call  script from bin directory. </p>
  
  <p>Crontab script looks like this:</p>
  
  <pre><code>*/59 * * * * script.py &amp;&gt;~concatenation.log
  </code></pre>
  
  <p>script.py calls another script as following:</p>
  
  <pre><code>subprocess.call('/home/sdcme/bin/nii_mdir_sdcme %s %s' % (a, a), shell=True)
  </code></pre>
  
  <p>can some one point it out why script.py is not able to call the other script. I suspect the problem is with PATh variable or other such thing but dont have nay idea how i should troubleshoot this..</p>
  
  <p>Thanks!</p>
  
  <p>Edit: nii_mdir_sdcme script calls another script niidicom_sdcme located in the same bin directory: Crontab mail, shows following error mail - </p>
  
  <pre><code>niidicom_sdcme: Command not found.
  niidicom_sdcme: Command not found.
  </code></pre>
  
  <p>Summary:</p>
  
  <p>cronatab-> script.py -> nii_mdir_sdcme -> niidicom_sdcme
  the problem is nii_mdir_sdcme is not able to call niidicom_sdcme. 
  But when i run script.py independently on command prompt everything works fine..</p>
  
  <p>nii_mdir_sdcme code:</p>
  
  <pre><code>#!/bin/tcsh
  if ($#argv &lt; 2) then
    echo "Usage: nii_mdir_sdcme start_dir# end_dir#"
    exit
  else    
   set start = $argv[1]
   set end = $argv[2]
  
    if ( ! -d ./medata ) then
     sudo mkdir ./medata
   endif
   sudo chown sdcme ./medata
   sudo chgrp users ./medata
  
   set i = $start
   while ( $i &lt;= $end )
     echo " "
     if ( $i &lt; 10 ) then
       echo "Entering 000$i..."
       cd 000$i
       sudo chmod 777 .
       niidicom_sdcme run0$i
       #mv *+orig.* ../medata
       sudo chmod 755 .
     else
       echo "Entering 00$i..."
       cd 00$i
       sudo chmod 777 .
       niidicom_sdcme run$i
       #mv *+orig.* ../medata
       sudo chmod 755 .
     endif
  
     cd ..
  
     @ i++  
   end
  </code></pre>
  
  <p>endif</p>