ok, nevermind. My coworker pointed out part of what's wrong. Guess I'll need to do more spelunking in my script to figure out what I'm messing up. -JB
________________________________ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Looney, James B Sent: Tuesday, May 08, 2007 4:17 PM To: python-list@python.org Subject: Using os.popen and os.chdir together Within a script on a *nix machine, I use os.chdir then os.popen, and it appears to me as though the os.chdir had no effect so far as the os.popen is concerned. Why's that? Here's what I'm doing: >>> import os >>> os.path.realpath( os.curdir ) '/home/jlooney' >>> print os.popen( "echo $PWD" ).readlines() ['/home/jlooney\n'] >>> >>> os.chdir( "/tmp" ) >>> os.path.realpath( os.curdir ) '/tmp' >>> print os.popen( "echo $PWD" ).readlines() ['/home/jlooney\n'] >>> You'll notice that initially, the current paths are the same, and correct. After I call os.chdir, and try os.popen, it's not in the new directory. When I do other things like creating new files, the chdir did exactly what I expected. What I don't understand is why os.popen appears to be special? How do I change directories within a script and have popen see that change? -JB
-- http://mail.python.org/mailman/listinfo/python-list