Finding dynamic libraries

MonkeeSage MonkeeSage at gmail.com
Fri Sep 15 20:39:05 EDT 2006


Bill Spotz wrote:
> Is there a way to tell an executing python script where to look for
> dynamically-loaded libraries?

If I understand, you want to tell an already running python process to
import some extensions from arbitrary locations? If that is correct,
you could use a file to hold the dynamic load paths (e.g.,
path-per-line), and then before you want to import the extensions do
something like:

load_file = file('paths')
for path in load_file.read().split("\n"):
  if not path in sys.path:
    sys.path.insert(0, path)
load_file.close()

Regards,
Jordan




More information about the Python-list mailing list