Skip to content
Vince Buffalo edited this page Feb 28, 2015 · 1 revision

By default, Python handles SIGPIPE in a non-standard way. There's more on this issue here and it has caused problems between Samtools and Tophat.

It can be solved with this fix from Colin Watson:

import signal
import subprocess

def subprocess_setup():
    # Python installs a SIGPIPE handler by default. This is usually not what
    # non-Python subprocesses expect.
    signal.signal(signal.SIGPIPE, signal.SIG_DFL)

subprocess.Popen(command, preexec_fn=subprocess_setup)
Clone this wiki locally