Setting UNIX environment with a Python script
Nom de Plume
not at all.com
Mon Mar 11 15:31:54 EST 2002
I connect to about 10 different servers which are various platforms,
e.g. Irix, AIX, Solaris, HP-UX. Each has different versions of Oracle
running on it with different SIDs based on what the others are using at
my work. Each time I want to change SIDs, I have an Oracle environment
file which I source and it sets the appropriate shell variables, e.g.
ORACLE_HOME =, etc.
I have written a little menu in Python which will determine the host
that I am connected to and present all the Oracle Environment files for
that server, along with a corresponding numeric option so that I just
have to type '3' and enter and it will set my Oracle environment for
that session.
The only step left is sourcing the ora_env.[name] file from within
Python in a way such that the environment of the parent shell is
modified. Anyone have any ideas? I have tried:
src_cmd = 'source ' + ora_env.file
os.system ( src_cmd )
but it doesn't like that.
More information about the Python-list
mailing list