I think I can best explain what I want by showing two bash sessions:

Session 1)
----------

$ /opt/csw/bin/python
Python 2.6.4 (r264:75706, Sep  9 2015, 15:05:38) [C] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> import cx_Oracle
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named cx_Oracle
>>> ^D

===================================

Session 2)
----------
$ ORACLE_OWNER=...
$ LD_LIBRARY_PATH=...
$ ORACLE_SID=...
$ TNS_ADMIN=...
$ LD_RUN_PATH=...
$ ORA_NLS33=...

$ export export LDFLAGS ORACLE_OWNER LD_LIBRARY_PATH ORACLE_SID TNS_ADMIN 
LD_RUN_PATH ORA_NLS33

$ /opt/csw/bin/python
Python 2.6.7 (r267:88850, Feb 10 2012, 01:39:24) [C] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> import cx_Oracle
>>>

========================================================

As you can see the import works in the second session because I
had done the needed assignments and exports in bash.

Now I was wondering, if I could do those kind of preparations in python.
I would like to start python from an unprepared bash, and do the necessary
stuff to make the import work.

I already tried changing os.environ and using os.putenv, but that didn't
seem to work.

-- 
Antoon Pardon
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to