changing LD_LIBRARY_PATH for Python script

Mail Archiving Daemon bboard at parc.xerox.com
Tue Mar 28 22:21:52 CEST 2000


Hi.  I'm in a situation where I need to set the LD_LIBRARY_PATH before
loading a Python module.  But I can't find a way of doing this from
Python.  By the time I'm actually in the Python script, the
interpreter is running, and changing the value of os.environ has no
effect on that process (or on the dl mechanism).  I could use a trick
like Martin's

#!/bin/sh
true=0;
then=1;
fi=1;
if true :
	then
	exec python "$0" "$@"
fi

del true, then, fi


If I could only figure out the right strings to put in there :-).

The code that is affected is a shared library loaded from *another*
shared library that is in turn loaded from Python as a Python module.

Bill




More information about the Python-list mailing list