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, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content