installing cx_Oracle.

C

Carl K

I am trying to use this:
http://python.net/crew/atuining/cx_Oracle/html/cx_Oracle.html
it is a real module, right?

sudo easy_install cx_Oracle did not easy_install cx_Oracle.

http://www.python.org/pypi/cx_Oracle/4.3.1 doesn't give me any clue.

I got the source from
http://prdownloads.sourceforge.net/cx-oracle/cx_Oracle-4.3.1.tar.gz?download

carl@dell17:~/a/cx_Oracle-4.3.1$ python setup.py build
Traceback (most recent call last):
File "setup.py", line 36, in ?
oracleHome = os.environ["ORACLE_HOME"]
File "/usr/lib/python2.4/UserDict.py", line 17, in __getitem__
def __getitem__(self, key): return self.data[key]
KeyError: 'ORACLE_HOME'


Now I don't really know whos problem this is.

Carl K
 
D

Diez B. Roggisch

Carl said:
I am trying to use this:
http://python.net/crew/atuining/cx_Oracle/html/cx_Oracle.html
it is a real module, right?

sudo easy_install cx_Oracle did not easy_install cx_Oracle.

http://www.python.org/pypi/cx_Oracle/4.3.1 doesn't give me any clue.

I got the source from
http://prdownloads.sourceforge.net/cx-oracle/cx_Oracle-4.3.1.tar.gz?download


carl@dell17:~/a/cx_Oracle-4.3.1$ python setup.py build
Traceback (most recent call last):
File "setup.py", line 36, in ?
oracleHome = os.environ["ORACLE_HOME"]
File "/usr/lib/python2.4/UserDict.py", line 17, in __getitem__
def __getitem__(self, key): return self.data[key]
KeyError: 'ORACLE_HOME'

yours. because you need the oracle OCI with libs and header files
installed + the environment variable ORACLE_HOME pointing to the
installation.

I suggest you download the appropriat oracle instant client for your system.

Diez
 
C

Carl K

Getting closer, thanks Bill and Diez.

$ export ORACLE_HOME
$ ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/client
$ python setup.py build
$ sudo python setup.py install

$ python -c "import cx_Oracle"
Traceback (most recent call last):
File "<string>", line 1, in ?
ImportError: libclntsh.so.10.1: cannot open shared object file: No such file or
directory

guessing I need to add
/usr/lib/oracle/xe/app/oracle/product/10.2.0/client/lib/
to some path?

btw - anyone know of a .deb that will install this?

Carl K
 
B

Bill Scherer

Carl said:
Getting closer, thanks Bill and Diez.

$ export ORACLE_HOME
$ ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/client
$ python setup.py build
$ sudo python setup.py install

$ python -c "import cx_Oracle"
Traceback (most recent call last):
File "<string>", line 1, in ?
ImportError: libclntsh.so.10.1: cannot open shared object file: No such file or
directory

guessing I need to add
/usr/lib/oracle/xe/app/oracle/product/10.2.0/client/lib/
to some path?
You can `export
LD_LIBRARY_PATH=/usr/lib/oracle/xe/app/oracle/product/10.2.0/client/lib`

or (assuming a recent RedHat linux (or similar) now), put that path in a
file, /etc/ld.so.conf.d/oracle.conf

and run /sbin/ldconfig

You'll find the latter operation to be persistent, and the former is not.
 
C

Carl K

Bill said:
You can `export
LD_LIBRARY_PATH=/usr/lib/oracle/xe/app/oracle/product/10.2.0/client/lib`

or (assuming a recent RedHat linux (or similar) now), put that path in a
file, /etc/ld.so.conf.d/oracle.conf

and run /sbin/ldconfig

You'll find the latter operation to be persistent, and the former is not.

bingo.

carl@dell17:~/a/cx_Oracle-4.3.1$ python
Python 2.4.4c1 (#2, Oct 11 2006, 21:51:02)
[GCC 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
[QUOTE= said:
>>> rows=cursor.fetchall()
>>> rows
[/QUOTE]
[(1, 'a ', 1.01), (2, 'a ', 1.02), (3, 'a ', 1.03)]

Thanks - now I can get to the real problem: client side join/order by :)

But I have already done it in MySql, so this should be the easy part...

Thanks again.

Carl K
 
S

Steve Holden

Dennis said:
Don't those lines need to be reversed? Set the variable in the
current shell, and /then/ export it?

Modern shells actually allow the single statement

export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/client

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
------------------ Asciimercial ---------------------
Get on the web: Blog, lens and tag your way to fame!!
holdenweb.blogspot.com squidoo.com/pythonology
tagged items: del.icio.us/steve.holden/python
All these services currently offer free registration!
-------------- Thank You for Reading ----------------
 
C

Carl K

Dennis said:
Don't those lines need to be reversed? Set the variable in the
current shell, and /then/ export it?

whoops - I may have cut/pasted too fast.

Carl K
 
C

Carsten Haese

Don't those lines need to be reversed? Set the variable in the
current shell, and /then/ export it?

It also works the other way around, at least on the non-empty set of
systems that contains my workstation. export simply marks the variable
name for automatic export to the environment of subsequent commands. The
value at that time doesn't matter. What matters is the value that the
name has at the time the command is run:

[carsten@dot ~]$ export FOOD
[carsten@dot ~]$ FOOD=spam
[carsten@dot ~]$ python -c "import os; print os.environ['FOOD']"
spam
[carsten@dot ~]$ FOOD=eggs
[carsten@dot ~]$ python -c "import os; print os.environ['FOOD']"
eggs

Regards,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top