Question: I have a cronjob that is the following:

```
*/10    *   *   *   *   root    cd /some/directory && python3 FILE.py >> Output.txt 2>&1

```

if i run that command from a regular command line, it works fine. But when ran from cronjob, I get `/bin/sh: python3: not found`

But when I run `echo $PATH` it returns

```
/sbin:/bin:/usr/sbin:/usr/bin:/usr/syno/sbin:/usr/syno/bin:/usr/local/sbin:/usr/local/bin:/usr/local/python3/bin:/opt/bin

```

(Note that `/usr/local/python3/bin` is included in this directory

How do I fix this?

Answer: 
It seems like cronjob has a different environment than your interactive shell. You could edit the cronjob to use an absolute path to call that python script. Or you can write a wrapper sh script to setup exactly the environment required by the python script and have cronjob execute that.

<https://askubuntu.com/questions/23009/reasons-why-crontab-does-not-work>
Since the environnemnt variable are not used when crontab is running either you create them in your script... 
...BUT YOU CAN ALSO check if /bin/python exits (or /sbin/python) and replace python with the one that exists :

```
*/10    *   *   *   *   root    cd /some/directory && /bin/python3 FILE.py >> Output.txt 2>&1

```

or

```
*/10    *   *   *   *   root    cd /some/directory && /sbin/python3 FILE.py >> Output.txt 2>&1

```