Working Ninja
2017-08-27T08:44:20
Python 2.7 Cron Script on CentOS 6

Python 2.7 is not provided on CentOS 6 because Yum depends on Python 2.6. Simply installing 2.7 over 2.6 will break Yum. Thankfully, Red Hat provides us with an alternate installation method through their SCL project.

First, get Python 2.7 installed:
https://www.softwarecollections.org/en/scls/rhscl/python27/

Next, add the project path to the top of the script:

import sys
sys.path.insert(0,'/path/to/project')
sys.path.insert(0,'/path/to/project/env/lib/python2.7/site-packages')

Lastly, call the script via Cron:

cat /path/to/project/script.py | scl enable python27 python