Message239028
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. |
|
Date |
User |
Action |
Args |
2015-03-23 14:28:11 | AndiDog | set | recipients:
+ AndiDog, docs@python |
2015-03-23 14:28:11 | AndiDog | set | messageid: <1427120891.65.0.0570880238086.issue23750@psf.upfronthosting.co.za> |
2015-03-23 14:28:11 | AndiDog | link | issue23750 messages |
2015-03-23 14:28:11 | AndiDog | create | |
|