ImportError: libclntsh.so.10.1: cannot open shared object file: Permission denied

dccarson at gmail.com dccarson at gmail.com
Thu Jul 27 17:57:38 EDT 2006


I have a similar question (importing cx_Oracle, but not related to
cron).  I would like to use solution #2 below and it does not work.  If
I set LD_LIBRARY_PATH before running python, it works.  If I try to set
it via os.environ, it does not work.

I have tried this in an interactive Python shell.  I can print the
value of os.environ["LD_LIBRARY_PATH"] and it is correct, but the
import fails.  The cx_Oracle.so file is found, but when it tries to
load the necessary Oracle library (libclntsh.so.9.0), I get the
message:

  ImportError: libclntsh.so.9.0: cannot open shared object file: No
such file or directory

Is there something else I have to do when changing os.environ before
trying the import?

Thanks,
David
P.S. Please post, as I don't read this e-mail account.

Damjan wrote:

> These environment variables are important for running any programs that use
> the oracle client libraries. The problem you have is that when you run the
> script from cron these environment variables are not set.
>
> Now, there are several ways how to handle this:
> 1. create a shell script that you call from cron, and it it set the
> environment variables and then call you python program
>
> 2. modify the environment in your python program (via os.environ) and then
> import cx_Oracle
>
> 3. modify your system so that no environment variables are neccesseary -
> actually this is not possible, but what I have is, symbolic links
> in /usr/lib to the libraries in $ORACLE_HOME/lib, thus I don't need the
> LD_LIBRARY_PATH variable, and the only other variable I need is the
> ORACLE_HOME, which is /usr/share/oracle on my system and it contains
> bin/  install/  lib/  network/  ocommon/  oracore/  rdbms/  sqlplus/
> 
> 
> 
> 
> -- 
> damjan




More information about the Python-list mailing list