i have a simple python script ( test.py ):
import cx_Oracle
from cx_Oracle
tns = cx_Oracle.makedsn('10.10.1.3', 1521, 'etst')
db = cx_Oracle.connect('test', 'test', tns)
it is work if I run script with enviroument settings:
export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib
./test.py
Can I set environment variables in python script ?
os.environ['LD_LIBRARY_PATH'] = "/usr/lib/oracle/11.2/client64/lib"
os.putenv('LD_LIBRARY_PATH', "/usr/lib/oracle/11.2/client64/lib/")
not work.
You can set them that way, however $LD_LIBRARY_PATH
is read by the loader which has already run before that therefore you must set that one externally beforehand.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With