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@python
components: Documentation
messages: 239028
nosy: Andreas Sommer, docs@python
priority: normal
severity: normal
status: open
title: Clarify difference between os.system/subprocess.call in section 
"Replacing os.system()"
type: enhancement

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23750>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to