[docs] [issue30798] Document that subprocess.Popen does not set PWD

James Lin report at bugs.python.org
Sat Jul 1 20:38:27 EDT 2017


James Lin added the comment:

Yes, but the Python docs have scary-looking warnings about using shell=True, so people (rightly) should avoid using shell=True if they don't think that they need it.  And in this case, people might not even know that they're invoking some binary that expects PWD from the shell.  

In my experience, it's not that uncommon for people to rewrite sh/bash shell scripts in Python.  Something starts off as a sh/bash script, evolves to a point where it's cumbersome to maintain, and it gets rewritten in Python.  But after it's rewritten, some invoked binaries might not behave as before, and it's unclear why.

When I encountered this problem myself, the first thing I tried was to explicitly set the `cwd` argument.  Some mention of the PWD environment variable would have saved me a lot of time.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30798>
_______________________________________


More information about the docs mailing list