Wednesday, June 5, 2013

sarge, a wrapper for Python's subprocess module

Welcome to sarge’s documentation! — Sarge 0.1.1 documentation

sarge provides a somewhat more user-friendly interface to the subprocess module from Python's standard library. It lets your Python program talk to external commands.

Some of the features of sarge include easier usage, security (has some support for preventing shell injection attacks), ability to capture the standard output/error/both of the subprocess it runs, support for I/O redirection and pipes, and even some support for interacting with the subprocess, like the Unix Expect tool can.

Overall, it looks worth checking out for those with such needs.

sarge is by Vinay Sajip, who is also the developer of Py, the Python launcher for Windows (with support for both Python 2 and Python 3), and of the logging module in the Python standard library.

Related links:

sarge.readthedocs.org/en/latest/tutorial.html

http://docs.python.org/2/library/subprocess.html

http://jugad2.blogspot.com/2013/04/py-python-launcher-for-windows.html

blog.python.org/2011/07/python-launcher-for-windows_11.html

For background on pipes and I/O redirection, see this article by me on IBM developerWorks:

Developing a Linux command-line utility:
http://www.ibm.com/developerworks/library/l-clutil/

Expect is a powerful Unix tool:

http://en.m.wikipedia.org/wiki/Expect

No comments: