CGI extension problem

Robin Becker robin at jessikat.demon.co.uk
Sat Apr 1 01:13:19 CEST 2000


I don't have root privilege, my python cgi script needs access to an extension which I have
built; the extension in turn needs a shared lib which I have built. I install in a directory say
$HOME/lib. When I run the cgi script I need to set the LD_LIBRARY_PATH to at least include
$HOME/lib. I have use the following idiom

import sys, os
HOME_LIB='/home/me/lib'
if sys.platform != 'win32' and not os.environ.has_key('LD_LIBRARY_PATH'):
        os.environ['LD_LIBRARY_PATH'] = HOME_LIB
        os.execve(sys.argv[0],sys.argv,os.environ)

# rest of cgi script
.....

I can think of a few ways in which this might break, but is there anything obviously easier less
breakable?
-- 
Robin Becker



More information about the Python-list mailing list