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

Miki miki.tebeka at
Mon Oct 6 18:09:26 CEST 2008

Hello All,

Can anybody explain why Makefile $(PWD) does show the right directory
when running under subprocess.Popen(..., cwd=...)

For example:
    [18:07] tmp $cat /tmp/p/Makefile
        @echo $(PWD)
    [18:07] tmp $cat t
    #!/usr/bin/env python

    from subprocess import Popen
    Popen(["make"], cwd="/tmp/p")

    [18:07] tmp $./t

The output of the "make" command should have been "/tmp/p" and not "/

Miki <miki.tebeka at>

More information about the Python-list mailing list