os.environ conflicts with my shell
Thomas Wouters
thomas at xs4all.net
Wed Mar 29 06:46:22 EST 2000
On Wed, Mar 29, 2000 at 11:30:58AM +0100, Michael Hudson wrote:
> > > How can I get the value of os.environ["NAME"] to stick in new xterm's
> > > environment?
> try os.system("xterm -e zsh -f &"); this disables the reading of most
> of the init files.
Actually, that wont work if zsh is the shell started by os.system() to start
the xterm (since the argument has a shell-meta-character, '&'), or if the
environment variable gets overwritten by the standard shell (like bash, on
most linux systems.)
To avoid that, you either have to do the fork() & exec() yourself, or start
the shell explicitly:
os.system("/bin/zsh -f -c 'xterm zsh -f &'")
or
os.system("/bin/bash -norc -c 'xterm bash -norc &'")
The best solution is probably to remove the explicit setting of the variable
in your .zshrc, and replace it with a conditional (only set it if it isn't
already set.)
--
Thomas Wouters <thomas at xs4all.net>
Hi! I'm a .signature virus! copy me into your .signature file to help me spread!
More information about the Python-list
mailing list