os.environ conflicts with my shell

Michael Hudson mwh21 at cam.ac.uk
Wed Mar 29 14:31:41 CEST 2000

Thomas Wouters <thomas at xs4all.net> writes:

> 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()

But it's not; man system says

       system() executes a command specified in string by calling
       /bin/sh -c string, and returns after the command has  been
       completed.   During execution of the command, SIGCHLD will
       be blocked, and SIGINT and SIGQUIT will be ignored.
> 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 &'")

How would that help?  If you think

os.system("xterm -e zsh -f &")

is run by the default shell, then surely

os.system("/bin/zsh -f -c 'xterm zsh -f &'")

would be too?

> 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.)



well, take it from an old hand: the only reason it would be easier
to program in C is that you can't easily express complex  problems
in C, so you don't.                 -- Erik Naggum, comp.lang.lisp

More information about the Python-list mailing list