[Tutor] cx_Oracle import problem in CGI

Jiang, Yonghua yoj11 at pitt.edu
Thu Nov 13 17:12:42 CET 2008


Dear Tutor,

Although several posts discussed how to solve the problem about cx_Oralce import, I struggled with that for quite long time without success. Following is the code I wrote:
#############################################
#!/opt/bin/python
import cgi
import sys
import os
os.environ['ORACLE_HOME']='/opt/local/sources/packages/oracle/product/8.1.7'
if os.environ.has_key('LD_LIBRARY_PATH'):
            ld_library_path=os.environ['LD_LIBRARY_PATH']
            os.environ['LD_LIBRARY_PATH']='%s/lib:%s' %(os.environ['ORACLE_HOME'],ld_library_path)
try: import cx_Oracle
except Exception,e:
            print '''
            <html>
            <head>
            <title>this is a test</title>
            </head>
            <body>'''
            print str(e)
            print sys.path
            print os.environ
            print '''
            </body>
            </Form>
            </html>'''

The result shows as following:
ld.so.1: python: fatal: libclntsh.so.8.0: open failed: No such file or directory

'/home/----/public_html', '/opt/depot/Python-2.3.4/lib/python23.zip', '/opt/depot/Python-2.3.4/lib/python2.3', '/opt/depot/Python-2.3.4/lib/python2.3/plat-sunos5', '/opt/depot/Python-2.3.4/lib/python2.3/lib-tk', '/opt/depot/Python-2.3.4/lib/python2.3/lib-dynload', '/opt/depot/Python-2.3.4/lib/python2.3/site-packages'

'HTTP_COOKIE': '__utma=135525616.6248723.1198085016.1225140952.1226422259.108; __utmz=135525616.1222720014.104.1.utmccn=(referral)|utmcsr=chronicle.pitt.edu|utmcct=/media/pcc021014/hillman_main.html|utmcmd=referral', 'SERVER_PROTOCOL': 'HTTP/1.1', 'SERVER_SOFTWARE': 'SISWEB', 'SCRIPT_NAME': '/~-----/index.cgi', 'SERVER_SIGNATURE': '', 'REQUEST_METHOD': 'GET', 'HTTP_UA_CPU': 'x86', 'QUERY_STRING': '', 'PATH': '/usr/bin:bin:/opt/bin', 'HTTP_USER_AGENT': 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; InfoPath.1; .NET CLR 3.0.04506.648)', 'TZ': 'US/Eastern', 'SERVER_NAME': 'www.xxx.www.edu', 'REMOTE_ADDR': '111.111.11.11', 'SERVER_PORT': '80', 'SERVER_ADDR': '1111.111.11.19', 'DOCUMENT_ROOT': '/home/webadm2/public_html', 'SCRIPT_FILENAME': '/home/-----/public_html/index.cgi', 'SERVER_ADMIN': 'webdev at mail.xxx.xxx.xxx', 'HTTP_HOST': 'www.xxx.xxx.xxx', 'HTTP_CONNECTION': 'Keep-Alive', 'REQUEST_URI': '/---/index.cgi', 'HTTP_ACCEPT': '*/*', 'GATEWAY_INTERFACE': 'CGI/1.1', 'REMOTE_PORT': '1900', 'HTTP_ACCEPT_LANGUAGE': 'en-us', 'ORACLE_HOME': '/opt/local/sources/packages/oracle/product/8.1.7', 'HTTP_ACCEPT_ENCODING': 'gzip, deflate', 'UNIQUE_ID': 'RY1DY4iOdAkAADAC5SgAAAAs'

Examining the sys.path and os.environ looks fine. The program works properly under Unix. Does anyone know how to solver this problem?

Thanks in advance.
yhjiang

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20081113/3516ad1d/attachment.htm>


More information about the Tutor mailing list