On Dec 2, 4:12 pm, Ulrich Eckhardt <eckha...@satorlaser.com> wrote: > eric.frederich wrote: > > Is there a way to set up environment variables in python itself > > without having a wrapper script. > > Yes, sure, you can set environment variables... > > > The wrapper script is now something like.... > > > #!/bin/bash > > > export LD_LIBRARY_PATH="/some/thing/lib:$LD_LIBRARY_PATH" > > export LD_LIBRARY_PATH="/another/thing/lib:$LD_LIBRARY_PATH" > > > export PATH="/some/thing/bin:$PATH" > > export PATH="/another/thing/bin:$PATH" > > > python ./someScript.py > > ...but this won't work, I'm afraid. > > LD_LIBRARY_PATH is for the program loader / dynamic linker under Linux. This > thing is what is invoked _before_ the program is started, any later > modifications to the environment are ignored. > > Similarly PATH, which tells the shell (e.g. bash) where to find executables. > If you need that to e.g. find 'python' itself, you're out of luck. > Otherwise, I believe Python itself doesn't use PATH, so you could set it > inside and any shells started from Python should pick it up. > > Uli > > -- > Sator Laser GmbH > Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932
I have had success in modifying LD_LIBRARY_PATH from within my Python code, to make sure that Python correctly loads DLL's from subdirectories of my project. (I believe the Python ended up calling CDll, or somesuch?) -- http://mail.python.org/mailman/listinfo/python-list