Search code examples
pythondjangocygwincx-oracle

python import cx_Oracle error on cygwin


I tried to install cx_Oracle from pypi source since there is no available port for it in cygwin. I did make some changes as suggested in http://permalink.gmane.org/gmane.comp.python.db.cx-oracle/2492 and modified my setup.py. However, I still get the following error :-

$ python
Python 2.7.3 (default, Dec 18 2012, 13:50:09)
[GCC 4.5.3] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cx_Oracle
/usr/lib/python2.7/site-packages/cx_Oracle-5.1.3-py2.7-cygwin-1.7.24-i686.egg/cx_Oracle.py:3: UserWa
rning: Module cx_Oracle was already imported from /usr/lib/python2.7/site-packages/cx_Oracle-5.1.3-p
y2.7-cygwin-1.7.24-i686.egg/cx_Oracle.pyc, but /home/zerog/cx_Oracle-5.1.3 is being added to sys.pat
h
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "build/bdist.cygwin-1.7.24-i686/egg/cx_Oracle.py", line 7, in <module>
  File "build/bdist.cygwin-1.7.24-i686/egg/cx_Oracle.py", line 6, in __bootstrap__
ImportError: Exec format error
>>>

If someone can please help me fix this ?

TIA.


Solution

  • Fixed this by specifying the path to instantclient as below :

    $ export PATH=$PATH:/cygdrive/d/Tools/instantclient_11_2
    

    (Other, possibly important stuff) :

    $ echo $LD_LIBRARY_PATH
    /cygdrive/d/Tools/instantclient_11_2
    $ echo $ORACLE_HOME
    /cygdrive/d/Tools/instantclient_11_2
    

    Now, I get :-

    $ python
    Python 2.7.3 (default, Dec 18 2012, 13:50:09)
    [GCC 4.5.3] on cygwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import cx_Oracle
    >>>