Troubles with PyDev and external libraries in OS X

Posted by Davide Gualano on Stack Overflow See other posts from Stack Overflow or by Davide Gualano
Published on 2010-05-21T09:49:57Z Indexed on 2010/05/21 10:10 UTC
Read the original article Hit count: 363

Filed under:
|
|

I've successfully installed the latest version of PyDev in my Eclipse (3.5.1) under OS X 10.6.3, with python 2.6.1
I have troubles in making the libraries I have installed work.
For example, I'm trying to use the cx_Oracle library, which is perfectly working if called from the python interpeter of from simple scripts made with some text editor.
But I cant make it work inside Eclipse: I have this small piece of code:

import cx_Oracle
conn = cx_Oracle.connect(CONN_STRING)
sql = "select field from mytable"
cursor = conn.cursor()
cursor.execute(sql)
for row in cursor:
    field = row[0]
    print field

If I execute it from Eclipse, I get the following error:

import cx_Oracle
  File "build/bdist.macosx-10.6-universal/egg/cx_Oracle.py", line 7, in <module>
  File "build/bdist.macosx-10.6-universal/egg/cx_Oracle.py", line 6, in __bootstrap__
ImportError: dlopen(/Users/dave/.python-eggs/cx_Oracle-5.0.3-py2.6-macosx-10.6-universal.egg-tmp/cx_Oracle.so, 2): Library not loaded: /b/227/rdbms/lib/libclntsh.dylib.10.1
  Referenced from: /Users/dave/.python-eggs/cx_Oracle-5.0.3-py2.6-macosx-10.6-universal.egg-tmp/cx_Oracle.so
  Reason: no suitable image found.  Did find:
    /Users/dave/lib/libclntsh.dylib.10.1: mach-o, but wrong architecture

Same snippet works perfectly from the python shell

I have configured the interpeter in Eclipse in preferences -> PyDev --> Interpreter - Python, using the Auto Config option and selecting all the libs found.

What am I doing wrong here?

Edit: launching

file /Users/dave/.python-eggs/cx_Oracle-5.0.3-py2.6-macosx-10.6-universal.egg-tmp/cx_Oracle.so

from the command line tells this:

/Users/dave/.python-eggs/cx_Oracle-5.0.3-py2.6-macosx-10.6-universal.egg-tmp/cx_Oracle.so: Mach-O universal binary with 3 architectures
/Users/dave/.python-eggs/cx_Oracle-5.0.3-py2.6-macosx-10.6-universal.egg-tmp/cx_Oracle.so (for architecture i386):  Mach-O bundle i386
/Users/dave/.python-eggs/cx_Oracle-5.0.3-py2.6-macosx-10.6-universal.egg-tmp/cx_Oracle.so (for architecture ppc7400):   Mach-O bundle ppc
/Users/dave/.python-eggs/cx_Oracle-5.0.3-py2.6-macosx-10.6-universal.egg-tmp/cx_Oracle.so (for architecture x86_64):    Mach-O 64-bit bundle x86_64

© Stack Overflow or respective owner

Related posts about python

Related posts about pydev