python cx_Oracle.DatabaseError: Error while trying to retrieve text for error ORA-01804

Problem Description:

Using Python package CX_ When setting scheduled tasks on the Oracle server, errors are always reported, such as the title, but running alone is no problem


Under the guidance of the boss, add a few lines of code in front of the script to solve the problem perfectly. The environment variable path is configured according to its 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'

Read More: