kmer_proc = Popen(['generate_kmers', str(kmer)], stdout=PIPE)
p = Popen(['pram_axdnull', str(kmer), input_filename, '-'], stdin=kmer_proc
    .stdout, stdout=PIPE)
kmer_proc.stdout.close()
output = p.communicate()[0]
Замена процесса в стиле Bash на Python Popen