subprocess.Popen(..., cwd=...) and Makefile $(PWD) don't play nice

Thomas Bellman bellman at lysator.liu.se
Tue Oct 14 05:35:22 EDT 2008


Miki <miki.tebeka at gmail.com> writes:

>> The problem is, he is not printing the name of the current working
>> directory; he is printing the value of the variable $PWD. =A0That is
>> likely set from the environment by the shell he started the Python
>> program from, but Python does *not* update to reflect changes to
>> the working directory.

> Should I see it as a bug? Should subprocess change this?

No, it's not a bug.  No, subprocess should not muck around with
the environment variables unless explicitly told to do so.

$PWD is only set by some (not all!) shells.  It should not be
trusted outside those shells, and hardly inside them either.


-- 
Thomas Bellman,   Lysator Computer Club,   Linköping University,  Sweden
"Adde parvum parvo magnus acervus erit"       ! bellman @ lysator.liu.se
          (From The Mythical Man-Month)       ! Make Love -- Nicht Wahr!



More information about the Python-list mailing list