Enviroment

Robert Milkowski milek at task.gda.pl
Fri Dec 10 10:59:19 EST 1999


On Fri, 10 Dec 1999, Fredrik Lundh wrote:

> Robert Milkowski <milek at task.gda.pl> wrote:
> > I call the program in Python as CGI.
> > I need to set up LD_LIBRARY_PATH enviroment to
> "/usr/lib:/lib:/mnt/1/NSIN/lib:/mnt/1/NSIN/egcs-libs:" before importing some modules.
> > How can I do it in Python?
> os.putennv(LD_LIBRARY_PATH,"/usr/lib:/lib:/mnt/1/NSIN/lib:/mnt/1/NSIN/egcs-libs:/mnt/1/NSIN/linux-li
> bs:")
> > doesn't work.
> 
> afaik, there's no error message in Python
> that just says "doesn't work".

:)))

> anyway, the correct syntax is:
> 
> os.environ["LD_LIBRARY_PATH"] = "/usr/lib etc

hmmmm but it makes no use of it while importing.
If I made a script

#!/bin/sh
export
LD_LIBRARY_PATH="/opt/SUNWspro/lib:/usr/openwin/lib:/usr/ucblib:/usr/local/lib:\
 /opt/IC/lib:/usr/lib:/lib:/mnt/1/NSIN/lib:"
/usr/local/bin/python test

then it works. But if I do

os.environ["LD_LIBRARY_PATH"] = "/opt/SUNWspro/lib:/usr/openwin/lib: \
 /usr/ucblib:/usr/local/lib:/opt/IC/lib:/usr/lib:/lib:/mnt/1/NSIN/lib:"


and run directly python script, it doesn't work.

Traceback (innermost last):
  File "/usr/local/apache/share/cgi-bin/test", line 14, in ?
    from aa import *
  File "/mnt/1/NSIN/python/aa.py", line 2, in ?
    import wqw
ImportError: ld.so.1: /usr/local/bin/python: fatal: libQWE.so.3.2: open
failed: No such file or directory
[Fri Dec 10 16:56:50 1999] [error] Premature end of script headers:
/usr/local/apache/share/cgi-bin/test_query

The library libQWE.so.3.2 is in /mnt/1/NSIN/lib.

So how can I inform system directly from python to make use of this
directory while searching libs?




-- 
						Robert Milkowski
						milek at task.gda.pl






More information about the Python-list mailing list