I am trying to set up crontab for a script written in python which is intalled via Anaconda. The simple .py runs (it just loads a module for a demo) and can be run in terminal with python a.py . The problem is getting crontab the path for python and imported modules.
I have been trying to set the PATH and PYTHONPATh to the python directory and also where pandas is located. I think this is a env issue but have no idea what that means. Any ideas?
The crontab is:
SHELL=/bin/sh
PYTHONPATH=/Users/Esel/anaconda3/bin/python
* * * * * cd /Users/Esel/Documents/x/y/z && python a.py
The python (test) script:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 18 21:36:34 2019
@author: Esel
"""
import pandas
print('hello kitty')
# This is a test
Crontab mails the following statement:
Traceback (most recent call last): File "a.py", line 3, in import pandas ImportError: No module named pandas