[Tutor] Struggling with os.exec

Rick Pasotto rick@niof.net
Thu May 22 11:12:02 2003


On Thu, May 22, 2003 at 05:03:15PM +0200, Charlie Clark wrote:
> 
> On 2003-05-21 at 20:59:40 [+0200], you wrote:
> > > has a bash (2.03) shell so this is essentially a "posix" question
> > > and "cd" is obviously a built-in command. Is it still possible to
> > > call "cd" from within Python?
> > 
> > You might need to do "bash -c 'cd /foo/bar'" or somesuch instead.
> > 
> > Just a guess, so probably wrong! :-/
> 
> That works without the 's but has seems to call the function "cd" as a
> process in it's own write, ie. with it's own environment variables.
> What I need to do is to be able to change the variables in the parent
> process, the one from which Python is called. I thought this would be
> easy but it's turning into a real challenge...

It is also impossible. A child process *cannot* alter its parent's
environment.

-- 
"A man who has nothing he is willing to fight for, nothing which he
cares more about than he does his own personal safety, is a miserable
creature, who has no chance of being free unless made and kept so by
the exertions of men better than himself. As long as justice and
injustice have not terminated their ever- renewing fight...human
beings must be willing...to do battle for the one against the other."
		-- John Stuart Mill
    Rick Pasotto    rick@niof.net    http://www.niof.net