title: Running crontab with python
body: <p>Python crontab script doesnt seem to work. When i run it manually, </p>
  
  <pre><code>python /home/ec2-user/code1.py
  </code></pre>
  
  <p>it works fine but when put into cron.txt file for the crontab, doesnt.</p>
  
  <p>My crontab file is:</p>
  
  <pre><code> @hourly python /home/ec2-user/code1.py &gt;/dev/null 2&gt;&amp;1
  </code></pre>
  
  <p>i also tried</p>
  
  <pre><code>0    *    *    *    * python /home/ec2-user/code1.py &gt;/dev/null 2&gt;&amp;1
  </code></pre>
  
  <p>But neither have much luck.</p>
  
  <pre><code>sudo crontab -l
  @hourly python /home/ec2-user/code1.py &gt;/dev/null 2&gt;&amp;1
  </code></pre>
  
  <p>Shows everything functional.
  I tried <a href="https://stackoverflow.com/questions/12534135/crontab-not-running-my-python-script">Crontab not running my python script</a> and couple others with not much luck either.</p>
  
  <h2>EDIT:</h2>
  
  <p>With </p>
  
  <pre><code>PATH=/opt/python2.7/bin  
  MAILTO=my@email
  */5 * * * * /home/ec2-user/code1.py
  </code></pre>
  
  <p>Email i get is:</p>
  
  <pre><code> /bin/sh: /home/ec2-user/code1.py : No such file or directory
  </code></pre>
  
  <p>Yet I can open and edit the file no problem. I tried many different thing but it comes down to this: cron doesnt see the file.</p>
  
  <p>Feels like I went through entire <a href="https://askubuntu.com/questions/23009/reasons-why-crontab-does-not-work">https://askubuntu.com/questions/23009/reasons-why-crontab-does-not-work</a>
  and still no luck</p>