python in cron job cannot find global environment setting for PYTHONPATH

Solution Verified - Updated -

Issue

  • As a user, put the below in .bash_profile, but it doesn't recognized in a cron job
export PYTHONPATH=/usr/local/python-2.7/lib/python2.7/site-packages
  • When the python script called directly, it does work properly
  • Created a file under /etc/profile.d with the below detail, but also cron job doesn't use it
export PYTHONPATH=/usr/local/python-2.7/lib/python2.7/site-packages

Environment

  • Red Hat Enterprise Linux

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.