CGI extension problem

Paul Gresham gresham at mediavisual.com
Fri Apr 7 12:37:05 EDT 2000


How about this, taken directly from my own python CGI scripts, I have all my
own python modules in a sub-directory called python, under my cgi-bin:

#!/usr/bin/python

#System imports
import cgi
import sys
import traceback

sys.stderr=sys.stdout
sys.path.insert(0, "./python")

Thats real simple, so maybe I've missed your point !

Regards
Paul

"Andrew Stribblehill" <a.d.stribblehill at dur.ac.uk> wrote in message
news:87ya6q5fqo.fsf at womble.dur.ac.uk...
> 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