Python help...
Mitch Anderson
mitch at metauser.net
Wed Oct 5 15:22:13 MDT 2005
Jonathan Ellis wrote:
>That's a sar message. Apparently it doesn't like being run as a
>subprocess, for some reason.
>
>The commands module is kind of old and busted. Use subprocess instead,
>which allows you to get stdout unmingled with stderr:
>
>import subprocess
>p = subprocess.Popen('sar 0 |grep -v foo', shell=True,
>stdout=subprocess.PIPE, stderr=subprocess.PIPE)
>p.stdout.read()
>
>
Thanks much this worked perfectly.
>(The UPyUG's october meeting will cover "python for sysadmins:"
>http://utahpython.org.)
>
I'll be there
Mitch
More information about the PLUG
mailing list