I tried to export path to system environment and what happens: Path is for BerkleyDB library (need for shelve Python library, without it I have an error:
File "/kplusnfs/script/ns/processes/current/kondor_processes.py", line 214, in load_processes_list_for_hostname
data_file = shelve.open((os.path.join(config.path_to_script, config.shelve_database)))
File "/usr/local/lib/python2.6/shelve.py", line 234, in open
return DbfilenameShelf(filename, flag, protocol, writeback)
File "/usr/local/lib/python2.6/shelve.py", line 218, in __init__
Shelf.__init__(self, anydbm.open(filename, flag), protocol, writeback)
File "/usr/local/lib/python2.6/anydbm.py", line 82, in open
mod = __import__(result)
File "/usr/local/lib/python2.6/dbhash.py", line 8, in <module>
import bsddb
File "/usr/local/lib/python2.6/bsddb/__init__.py", line 64, in <module>
import _bsddb
ImportError: ld.so.1: python: fatal: libdb-4.7.so: open failed: No such file or directory
When I add export to .bashrc line:
export LD_LIBRARY_PATH="/kplusnfs/script/ns/BerkleyDB/lib"
And reload bash then library is loaded.
Library path contains files:
ll /kplusnfs/script/ns/BerkleyDB/lib
total 12936
-rwxrwxrwx 1 c310176 atwuser 1470380 Aug 2 03:19 libdb-4.7.a
-rwxrwxrwx 1 c310176 atwuser 1078 Aug 2 03:19 libdb-4.7.la
-rwxrwxrwx 1 c310176 atwuser 1211376 Aug 2 03:19 libdb-4.7.so
-rwxrwxrwx 1 c310176 atwuser 1211376 Aug 2 03:19 libdb-4.so
-rwxrwxrwx 1 c310176 atwuser 1470380 Aug 2 03:19 libdb.a
-rwxrwxrwx 1 c310176 atwuser 1211376 Aug 2 03:19 libdb.so
I tried to use in code:
0
import os
1
os.environ["LD_LIBRARY_PATH"] = "/kplusnfs/script/ns/BerkleyDB/lib/"
2
os.system('export LD_LIBRARY_PATH="/kplusnfs/script/ns/BerkleyDB/lib"')
3
os.putenv("LD_LIBRARY_PATH", "/kplusnfs/script/ns/BerkleyDB/lib/")
And each time it was not working. But option #2 + below code for reloading bash:
os.system('bash')
did helped. But run of script was ridiculous, because it was loading bash and leaving previous operations...
So my question is - is there possible way not only to set variable but also load library for my user without reloading bash?
Ps. I do not have root privileges, so I am unable to change anything within the system (including installing any Python libraries)