[Python-Dev] subprocess shell=True on Windows doesn't escape ^ character (original) (raw)
Brian Curtin brian at python.org
Thu Jun 12 06:27:23 CEST 2014
- Previous message: [Python-Dev] subprocess shell=True on Windows doesn't escape ^ character
- Next message: [Python-Dev] subprocess shell=True on Windows doesn't escape ^ character
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Wed, Jun 11, 2014 at 9:43 PM, Ethan Furman <ethan at stoneleaf.us> wrote:
On 06/11/2014 07:12 PM, Chris Angelico wrote:
On Thu, Jun 12, 2014 at 12:07 PM, Chris Angelico <rosuav at gmail.com> wrote:
ISTM what you want is not shell=True, but a separate function that follows the system policy for translating a command name into a path-to-binary. That's something that, AFAIK, doesn't currently exist in the Python 2 stdlib, but Python 3 has shutil.which(). If there's a PyPI backport of that for Py2, you should be able to use that to figure out the command name, and then avoid shell=False. Huh. Next time, Chris, search the web before you post. Via a StackOverflow post, learned about distutils.spawn.findexecutable(). --> import sys --> sys.executable '/usr/bin/python'
For finding the Python executable, yes, but the discussion and example are about a 2.x version of shutil.which
- Previous message: [Python-Dev] subprocess shell=True on Windows doesn't escape ^ character
- Next message: [Python-Dev] subprocess shell=True on Windows doesn't escape ^ character
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]