When using the python package cx_Oracle
, an error is always reported when setting up a scheduled task on the server. The error content is like the title, but it is no problem to run it alone.
Add a few lines of code before the script, which is a perfect solution. The environment variable path is configured according to your own path.
import os
os.environ["ORACLE_HOME"] = '/home/oracle/app/oracle/product/11.2.0/dbhome_1'
os.environ["ORACLE_BASE"] = '/home/oracle/app/oracle'
os.environ["ORACLE_SID"] = 'orcl'
os.environ["LD_LIBRARY_PATH"] = '/home/oracle/app/oracle/product/11.2.0/dbhome_1/lib:/lib:/usr/lib'