Bonus: simple python socket client
Comments are moderated. It may take a few minutes before your comment appears.
Markdown is supported in your comments.
First, accessing the command line from Python. There are a lot of old ways to do this (os.call, Popen) but these are deprecated in favor of the subprocess module.
pipe_command() wraps subprocess and manages standard I/O. The first line makes sure there is input before attaching the input pipe. The second line launches the command supplied by
arg_list. The remaining lines pipe the input (if any) and return the output through