Importing Python libraries in Openshift cron jobs
Question: 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?


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

