I have some code that connects to Oracle via cx_Oracle + SQL Alchemy.

This code works fine under unittest and in actual use.  It fails when under 
pytest.

The actual error message I get is:

````
sqlalchemy.exc.DatabaseError: (cx_Oracle.DatabaseError) DPI-1047: Cannot 
locate a 64-bit Oracle Client library: 
"dlopen(/Users/jluc/bin/oracle/instantclient_12_1/lib/libclntsh.dylib, 1)
````

OK, the funny thing is that libclntsh.dylib does exist:

````
$ which libclntsh.dylib
/Users/jluc/bin/oracle/instantclient_12_1/libclntsh.dylib
````
But notice that it's under instantclient_12_1, not instantclient_12_1/lib 
as in the error message.

There is NO /lib/ subdirectory under instantclient_12_1 which is where 
SQLAlchemy wants it, but only when running under pytest (works fine 
everywhere else).

My workaround?  created a lib subdirectory and copied everything from above 
it:

mkdir lib
cd lib 
cp ../* .

````
/Users/jluc/bin/oracle/instantclient_12_1
├── help
│   ├── ja
│   │   ├── META-INF
│   │   ├── img
│   │   └── img_text
│   └── us
│       ├── META-INF
│       ├── img
│       └── img_text
├── lib  👈 added this, then cp ../* .
└── sdk
    ├── admin
    ├── demo
    └── include

14 directories

````

It works, but I have no idea why I had to do this.  I tried symlinking 
first but it kept on complaining about other missing libs so I gave in and 
copied instead.



versions:  
macos Mojave, 
cx-Oracle                     8.0.1
pytest                        6.1.2
pytest-cov                    2.10.1
SQLAlchemy                    1.3.18
Python 3.8.6

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/9f994858-f5a3-4c61-b7b3-ae901c9e19cdn%40googlegroups.com.

Reply via email to