Cron & Python + Package
vkolosov at unitedmedia.com
Thu Feb 3 16:26:52 CET 2000
I have written a python script and wish to run it as a cron job. As a stand
alone program it runs just fine, but when I try to run it via crontab I seem
to be missing some environment variables(I'm on UNIX).
I went ahead and used os.environ to populate my environment and placed it
at the very beginning of the python script, but it still does not work.
I have written a small shell script to do exactly the same thing, that is to
set the environment before calling the python script - it worked.
Nevertheless I feel it destroys the purpose of using python in the first
My understanding of os.environ is that it could be set as
os.environ['PATH']='.:/usr/lib:/usr/local/lib' but for some reason this
environment is not available for the rest of the script immediately(in my
case for package import).
Am I doing something wrong?
The problem is only when a python package uses C libraries and in this case
requires LD_LIBRARY_PATH to be set.
The following is the error message that I get.
Python 1.5.2 (#2, Apr 20 1999, 16:06:35) [GCC 2.8.1] on sunos5
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import DCOracle
Traceback (innermost last):
File "<stdin>", line 1, in ?
File "/usr/local/lib/python1.5/DCOracle/__init__.py", line 66, in ?
from ocidb import Connect, error
File "/usr/local/lib/python1.5/DCOracle/ocidb.py", line 50, in ?
import oci_, ociCurs, ociProc
ImportError: ld.so.1: /usr/local/bin/python: fatal: libclntsh.so.8.0: open
failed: No such file or directory
More information about the Python-list