subprocess problem

Cameron Simpson cs at zip.com.au
Thu Feb 9 20:56:13 EST 2017


On 10Feb2017 00:03, eryk sun <eryksun at gmail.com> wrote:
>On Thu, Feb 9, 2017 at 10:50 PM, Cameron Simpson <cs at zip.com.au> wrote:
>> This is why I suggested the check_returncode() method, which examines the
>> error code.
>
>You must be thinking of the returncode attribute, which isn't a
>method. check_returncode() is a method of the CompletedProcess object
>that's returned by subprocess.run(), which was added in 3.5. The OP is
>using both 3.4 and 3.5, so run() isn't a practical option.

The communicate method mentioned it; I hadn't realised it was new with 3.5, 
good point.

>The older check_output() function also checks the return code and
>raises a subprocess.CalledProcessError if the command fails. For
>example: [...]

Cool,
Cameron Simpson <cs at zip.com.au>



More information about the Python-list mailing list