[Python-ideas] shutil.runret and shutil.runout
anatoly techtonik
techtonik at gmail.com
Fri Feb 24 11:52:10 CET 2012
Hello,
subprocess is low level, cryptic, does too much, with poor usability,
i.e. "don't make me think" is not about it. I don't know about you,
but I can hardly write any subprocess call without spending at least
5-10 meditating over the documentation. So, I propose two high level
KISS functions for shell utils (shutil) module:
runret(command) - run command through shell, return ret code
runout(command) - run command through shell, return output
To avoid subprocess story (that makes Python too complicated) I
deliberately limit the scope to:
- executing from shell only
- return one thing at a time
I hope that this covers 80% of what _users_ need to execute commands
from Python. If somebody needs more - there is `subprocess`. But if
your own scripts are mostly outside these 80% - feel free to provide
your user story and arguments, why this should be done in shutil and
not in subprocess.
Open questions:
- security quoting for 'command'
--
anatoly t.
More information about the Python-ideas
mailing list