Python + cx_Oracle: unable to get Oracle environment processing

Background .
My OS is Win7 64bit.
My Python is 2.7 64 bit from python-2.7.8.amd64.msi
My cx_Oracle 5.0 64 bit is from cx_Oracle-5.0.4-10g-unicode.win-amd64-py2.7.msi
My Oracle client is 10.1 (I don't know the 32 or 64 arch, but SQL * Plus is 10.1.0.2.0

The database is Oracle Database 10g Enterprise Edition version 10.2.0.4.0 - 64bit
PL / SQL Release 10.2.0.4.0 -
CORE production 10.2.0.4.0
TNS production for Windows 64 bit: version 10.2.0.4.0 -
NLSRTL Production Version 10.2.0.4.0 - Production

ORACLE_HOME , added from haki's answer.
C: \ Oracle \ product \ 10.1.0 \ Client_1 \

The job problem does not persist.

ORACLE_HOME Try Oracle instantly from instantclient-basic-win64-10.2.0.5.zip C: \ instantclient_10_2 \

C: \ Users \ PavilionG4> sqlplus Lee / 123 @chstchmp
SQL * Plus Initialization Error 6
Message file sp1.msb not found
SP2-0750: You may need to set ORACLE_HOME to Oracle software directory

My sql * plus won't let me install Oracle.

ORACLE_HOME Go back to site C: \ Oracle \ product \ 10.1.0 \ Client_1 \

PATH variable
C: \ Program Files (x86) \ Seagate Software \ NOTES \
C: \ Program Files (x86) \ Seagate Software \ NOTES \ DATA \
C: \ Program Files (x86) \ Java \ jdk1.7.0 _05 \ bin
C : \ Oracle \ product \ 10.1.0 \ Client_1 \ Bin
C: \ Oracle \ product \ 10.1.0 \ Client_1 \ JRE \ 1.4.2 \ Bin \ client
C: \ Oracle \ product \ 10.1.0 \ Client_1 \ JRE \ 1.4.2 \ bin
C: \ application \ PavilionG4 \ product \ 11.2.0 \ dbhome_1 \ Bin
C: \ application \ PavilionG4 \ product \ 11,2.0 \ client_2 \ bin
c: \ Program Files (x86) \ AMD APP \ bin \ x86_64
c: \ Program Files (x86) \ AMD APP \ bin \ x86
C: \ Windows \ system32
C: \ Windows
C: \ Windows \ System32 \ Wbem
C: \ Windows \ System32 \ WindowsPowerShell \ v1.0 \
c: \ Program Files (x86) \ ATI Technologies \ ATI.ACE \ Core-Static
C: \ Users \ PavilionG4 \ AppData \ Local \ Smartbar \ Application \
C: \ PROGRA ~ 2 \ IBM \ SQLLIB \ BIN
C: \ PROGRA ~ 2 \ IBM \ SQLLIB \ FUNCTION
C: \ Program Files \ gedit \ bin
C: \ Kivy-1.7.2-w32
C: \ Program Files (x86) \ ZBar \ binj
C: \ Program Files (x86) \ Java \ jdk1.7.0_05 \ bin
C: \ Program Files \ MATLAB \ R2013a \ runtime \ win64
C: \ Program Files \ MATLAB \ R2013a \ b to
C: \ python27

TNS :
C: \ Oracle \ product \ 10.1.0 \ Client_1 \ NETWORK \ ADMIN \ tnsnames.ora
REPORT1 =
(DESCRIPTION =
  (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP) (HOST = 172.28.128.110) (PORT = 1521) )
  )
  (CONNECT_DATA =
    (SERVICE_NAME = REPORT1)
  )
)

f1.py shows me an error
import cx_Oracle
ip = '172,25,25,42'
port = 1521
SID = 'REPORT1'
dns_tns = cx_Oracle.makedsn (ip, port, SID)
connection = cx_Oracle.connect (u "Li", u "123", dns_tns)
cursor = connection.cursor () connection.close ()


Traceback error (last call last):
File "f1.py", line 6, in
  connection = cx_Oracle.connect (u "Lee", u "123", dns_tns)
cx_Oracle.InterfaceError: Unable to get Oracle environment handle

Questions
1. How to get the processing of the Oracle environment?
I searched for sites. Unfortunately they don't address my problem at all.
2. How do I let Python use another Oracle client without affecting the existing one?

+3


source to share


1 answer


If python finds more than one OCI.DLL file in the path (even if they are identical) it throws this error. (Your path operator looks like it can call more than one). You can manipulate the track inside your script to limit where python will look for supporting ORACLE files, which might be your only option if you must run multiple versions of oracle / clients locally.



+2


source







All Articles