CGI extension problem

Andrew Stribblehill a.d.stribblehill at dur.ac.uk
Fri Apr 7 07:10:07 EDT 2000


Robin Becker <robin at jessikat.demon.co.uk> writes:

> 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?

Wouldn't it be better to use LD_RUN_PATH when /compiling/ the
extension? Then it won't need a LD_LIBRARY_PATH variable at
runtime.

Obviously you then have to make sure that this location stays
the same else you'll need to resort to the LD_LIBRARY_PATH hack (or
recompile) again!

Cheerio,

Andrew Stribblehill
Systems Programmer, IT Service, University of Durham, England



More information about the Python-list mailing list