pipesの使い方

何かのコマンドを実行してその結果がほしい場合はpipesを使用する。
入力が必要な場合はappendで不要な場合はprependを使う。

import pipes
import tempfile
def auto():
    t=pipes.Template()
    t.prepend('python -c "import time;time.sleep(10);print \'hello\'"','.-')
    tmp = tempfile.mktemp()
    f=t.open_r(tmp)
    print f.read()
auto()

実行すると10秒後にhelloと表示される