Re: Environment Variables

Steven D. Majewski (sdm7g@elvis.med.virginia.edu)
Wed, 27 Apr 1994 18:27:32 -0400

Which reminds me of another problem:

( as root )

import pwd,posix
user=pwd.getpwnam( username )
posix.setuid( user[2] )
posix.chdir( user[-2] )

Now *how* do you exec a users .profile so you can get the proper
environment variables set and read back into python ?

I've tried:
posix.popen( "ksh -c '. ./profile ; env'" , 'r' ).readlines()

( and a few other variations ) but I get the OLD variables!

- Steve Majewski (804-982-0831) <sdm7g@Virginia.EDU>
- UVA Department of Molecular Physiology and Biological Physics