サブプロセスライブラリを使用して、Pythonモジュールからgrepコマンドを実行しようとしています。docファイルでこの操作を行っているので、Catdocサードパーティライブラリを使用して、プランテキストファイルのコンテンツを取得しています。コンテンツをファイルに保存したい。どこが間違っているのかわかりませんが、プログラムはプレーンテキストファイルを生成できず、最終的にgrepの結果を取得できません。エラーログを確認しましたが、空です。すべての助けをありがとう。
def search_file(name, keyword):
    #Extract and save the text from doc file
    catdoc_cmd = ['catdoc', '-w' , name, '>', 'testing.txt']
    catdoc_process = subprocess.Popen(catdoc_cmd, stdout=subprocess.PIPE,stderr=subprocess.PIPE, shell=True)
    output = catdoc_process.communicate()[0]
    grep_cmd = []
    #Search the keyword through the text file
    grep_cmd.extend(['grep', '%s' %keyword , 'testing.txt'])
    print grep_cmd
    p = subprocess.Popen(grep_cmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE, shell=True)
    stdoutdata = p.communicate()[0]
    print stdoutdata