[Tutor] Can I set LD_LIBRARY_PATH within a .py file?

Albert-Jan Roskam fomcl at yahoo.com
Sat Oct 15 21:51:32 CEST 2011


Hello,

Can I set the LD_LIBRARY_PATH environment variable (on-the-fly) within a .py file? 

I would like to use an .so-file that lives in a non-standard location.


This does not work:

try:

   os.environ["LD_LIBRARY_PATH"]  += (":" + path)
except KeyError:
   os.environ["LD_LIBRARY_PATH"] = path

Currently, I can only run the program in the terminal:
export LD_LIBRARY_PATH=/home/dude/Desktop/test
python /home/dude/Desktop/testLoadLibLinux.py

This works (yaaayy!), but I'd like to run the .py file directly.
Is this possible? I also don't  like the fact that I can't test the .py file in Idle.

Perhaps a complicating factor is a bug in LD_LIBRARY_PATH
in Linux Ubuntu 10 (the version I'm using):https://bugs.edge.launchpad.net/ubuntu/+source/xorg/+bug/366728
https://bugs.launchpad.net/ubuntu/+source/xorg/+bug/366728/comments/21

solution:

sudo gedit /etc/X11/Xsession.options
(change "use-ssh-agent" into "no-use-ssh-agent")


Thank you in advance for your thoughts!

 
Cheers!!
Albert-Jan


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20111015/3a38f21e/attachment.html>


More information about the Tutor mailing list