[New-bugs-announce] [issue23750] Clarify difference between os.system/subprocess.call in section "Replacing os.system()"

Andreas Sommer report at bugs.python.org
Mon Mar 23 15:28:11 CET 2015


New submission from Andreas Sommer:

Reading over the section "Replacing os.system()" (https://docs.python.org/2/library/subprocess.html#replacing-os-system), one might assume that the return value of os.system and subprocess.call are equivalent.

    status = os.system("mycmd" + " myarg")
    # becomes
    status = subprocess.call("mycmd" + " myarg", shell=True)

However, they are not. Example:

    import sys
    import os
    import subprocess

    print subprocess.call("false")
    print os.system("false")

gives 1 and 256, respectively. Maybe this could be rephrased for clarity, or a hint added.

----------
assignee: docs at python
components: Documentation
messages: 239028
nosy: Andreas Sommer, docs at python
priority: normal
severity: normal
status: open
title: Clarify difference between os.system/subprocess.call in section "Replacing os.system()"
type: enhancement

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


More information about the New-bugs-announce mailing list