Scenes (scenarios, user stories, ...) of program execution with Python.

<insert hangman picture here>

Core Subprocess "features" to watch for:

Fire and Forget

Crossplatform shell automation

I am a user, who tired of writing shell commands by hand, and wants a crossplatform way of executing them on Window/Linux/Mac OS. I don't care about security - I am my own evil Pinocchio.

1. "i only care that the program is successfully started"

subprocess way

subprocess.Popen(command, shell=True)


Libraries on Execution

Notes about bad design in subprocess

check_call() or check_output() are shortcuts for executing Popen calls (convenience functions), but they modify the error handling behavior, leading to new exceptions when return codes are not the same. There is a also a call() helper that doesn't add new exceptions in this case and repeats Popen behaviour. This is what is called "inconsistent design" of API.

The check_* in the names of the helpers is probably because of those added exceptions, but that's not obvious. Names became non-friendly for humans. There might be a good rational user story behind this change, but it is missing in the context of this API, so as a user, I don't have a chance to memorize the conditions, when this can be handy. Defining the conditions is the goal of writing this page.

ExecutionScenarios (last edited 2013-03-19 07:43:11 by techtonik)

Unable to edit the page? See the FrontPage for instructions.