Closed vijayanand closed 3 years ago
Since you're using backslashes in the path, you need to use the commented out 'raw' string syntax r"..."
.
Review https://cx-oracle.readthedocs.io/en/latest/user_guide/installation.html#troubleshooting
In addition, set the environment variable DPI_DEBUG_LEVEL
to the value 64 and rerun your script. That will show additional information on what locations are being tried for the shared library and what errors are being reported while doing so.
Added the environment variable and ran the config.py with the raw syntax r"..."(I tried a bunch of combination earlier) The output was:
ODPI [26348] 2021-01-12 09:59:55.484: ODPI-C 4.1.0
ODPI [26348] 2021-01-12 09:59:55.484: debugging messages initialized at level 64
ODPI [26348] 2021-01-12 09:59:55.493: Context Parameters:
ODPI [26348] 2021-01-12 09:59:55.493: Oracle Client Lib Dir: C:\Oracle\instantclient_19_9
ODPI [26348] 2021-01-12 09:59:55.493: Environment Variables:
ODPI [26348] 2021-01-12 09:59:55.493: PATH => "C:\Program Files\Python39\Scripts\;C:\Program Files\Python39\;C:\Oracle\18.0.0\dbhomeXE\bin;C:\Program Files\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\Program Files\PuTTY\;C:\Program Files (x86)\Mitel\Connect\;C:\Program Files (x86)\ShoreTel\Connect\;C:\Program Files\Microsoft VS Code\bin;C:\Oracle\instantclient_19_9;C:\Users\Vijay Anand\AppData\Local\Microsoft\WindowsApps;C:\Users\Vijay Anand\AppData\Local\atom\bin;%USERPROFILE%\AppData\Local\Microsoft\WindowsApps;"
ODPI [26348] 2021-01-12 09:59:55.494: load in parameter directory
ODPI [26348] 2021-01-12 09:59:55.494: load in dir C:\Oracle\instantclient_19_9
ODPI [26348] 2021-01-12 09:59:55.494: load with name C:\Oracle\instantclient_19_9/oci.dll
ODPI [26348] 2021-01-12 09:59:55.500: load by OS successful
ODPI [26348] 2021-01-12 09:59:55.500: validating loaded library
Running: python ntest.py
platform.platform: Windows-10-10.0.19041-SP0
sys.maxsize > 2**32: True
platform.python_version: 3.9.1
Running robot database.robot
==============================================================================
Database
==============================================================================
Test Connetion ODPI [27440] 2021-01-12 10:04:56.769: ODPI-C 4.1.0
ODPI [27440] 2021-01-12 10:04:56.769: debugging messages initialized at level 64
ODPI [27440] 2021-01-12 10:04:56.770: Context Parameters:
ODPI [27440] 2021-01-12 10:04:56.770: Environment Variables:
ODPI [27440] 2021-01-12 10:04:56.770: PATH => "PATH_TO_YOUR_INSTANT_CLIENT\instantclient_18_3"
ODPI [27440] 2021-01-12 10:04:56.771: check module directory
ODPI [27440] 2021-01-12 10:04:56.772: module name is C:\Users\Vijay Anand\AppData\Roaming\Python\Python39\site-packages\cx_Oracle.cp39-win_amd64.pyd
ODPI [27440] 2021-01-12 10:04:56.772: load in dir C:\Users\Vijay Anand\AppData\Roaming\Python\Python39\site-packages
ODPI [27440] 2021-01-12 10:04:56.773: load with name C:\Users\Vijay Anand\AppData\Roaming\Python\Python39\site-packages/oci.dll
ODPI [27440] 2021-01-12 10:04:56.773: load by OS failure: The specified module could not be found
ODPI [27440] 2021-01-12 10:04:56.773: load with OS search heuristics
ODPI [27440] 2021-01-12 10:04:56.773: load with name oci.dll
ODPI [27440] 2021-01-12 10:04:56.774: load by OS failure: The specified module could not be found
Test Connetion | FAIL |
DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library: "The specified module could not be found". See https://cx-oracle.readthedocs.io/en/latest/user_guide/installation.html for help
------------------------------------------------------------------------------
Database | FAIL |
1 critical test, 0 passed, 1 failed
1 test total, 0 passed, 1 failed
==============================================================================
That's the same error
So in the first case the script ran successfully. In the second case it did not. The output, though, shows PATH_TO_YOUR_INSTANT_CLIENT\instantclient_18_3
-- which means you never changed that. Why aren't you using the first approach since that works?
Thanks Anthony. Got a robot library without documentation. After modifying, now I am able to connect.
platform.platform: Windows-10-10.0.19041-SP0 sys.maxsize > 2**32: True platform.python_version: 3.9.1
cx_Oracle.init_oracle_client(lib_dir=r"C:\Oracle\instantclient_19_9")
cx_Oracle.init_oracle_client(lib_dir= "C:\Oracle\instantclient_19_9")
ran this code: python config.py
I ran a test script:
python test.py
Then ran: robot database.robot
This gives me: Test Connetion | FAIL | DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library: "The specified module could not be found". See https://cx-oracle.readthedocs.io/en/latest/user_guide/installation.html for help
64 bit client
Show what the
PATH
environment variable (on Windows) orLD_LIBRARY_PATH
(on Linux) is set to? PATH=C:\Program Files\Python39\Scripts\;C:\Program Files\Python39\;C:\Oracle\18.0.0\dbhomeXE\bin;C:\Program Files\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\Program Files\PuTTY\;C:\Program Files (x86)\Mitel\Connect\;C:\Program Files (x86)\ShoreTel\Connect\;C:\Program Files\Microsoft VS Code\bin;C:\Oracle\instantclient_19_9;C:\Users\Vijay Anand\AppData\Local\Microsoft\WindowsApps;C:\Users\Vijay Anand\AppData\Local\atom\bin;%USERPROFILE%\AppData\Local\Microsoft\WindowsApps;Show any Oracle environment variables set (e.g. ORACLE_HOME, ORACLE_BASE). None