Interactive os.environ vs. os.environ in script

Thinker thinker at branda.to
Mon Feb 26 11:44:55 EST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

boris.smirnov at gmail.com wrote:
>
> OK then I have to reformulate my question. :)
>
> In my script I have a line with
>
> os.environ["LD_LIBRARY_PATH"]='/path/Linux/rh_linux'
>
> but this line didn't work. But when I set this environment variable
> in Linux shell it works. Here is a small example.
>
>> python shrink_bs_070226.py
> Traceback (most recent call last): File "shrink_bs_070226.py", line
> 25, in ? from qt import * File
> "/path/Linux/python/rh_linux/lib/python2.2/site-packages/ qt.py",
> line 46, in ? import libsip ImportError: libadamsqt.so: cannot open
> shared object file: No such file or directory
ld-elf.so reads environment variables when it was loaded.
It never reads environment variables again!
That you setting environment in the process does not make link-editor
to re-read environment variable and take effect.

To resolve the problem, you can try to add the path to sys.path.

- --
Thinker Li - thinker at branda.to thinker.li at gmail.com
http://heaven.branda.to/~thinker/GinGin_CGI.py
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF4w6H1LDUVnWfY8gRAoI0AKCLikYsFU2N6aaOZFDd1L2KY8DjqACg3QQn
KsEEcrvpw1CktEkVCKe/ojk=
=EQG6
-----END PGP SIGNATURE-----




More information about the Python-list mailing list