Importing Python libraries in Openshift cron jobs

159 Views Asked by At

I have a script in .openshift/cron/daily that looks like this

#!/usr/bin/python
import sys
import os
sys.path.append(os.environ['OPENSHIFT_REPO_DIR'])
import EmilyBlogModel
EmilyBlogModel.Poll()

EmilyBlogModel.py is in $OPENSHIFT_REPO_DIR

However, when the cron job runs, I get an ImportError

No module named EmilyBlogModel

Why isn't this working?

1

There are 1 best solutions below

0
On

Have you tried printing the system path before the import statement? OPENSHIFT_REPO_DIR might be pointing to the wrong path.