Subprocess fails to catch the standard output

Posted by user343934 on Stack Overflow See other posts from Stack Overflow or by user343934
Published on 2010-05-18T11:21:35Z Indexed on 2010/05/18 13:20 UTC
Read the original article Hit count: 323

Filed under:
|
|

I am trying to generate tree with fasta file input and Alignment with MuscleCommandline

import sys,os, subprocess
from Bio import AlignIO
from Bio.Align.Applications import MuscleCommandline
cline = MuscleCommandline(input="c:\Python26\opuntia.fasta")
child= subprocess.Popen(str(cline),
                         stdout = subprocess.PIPE,
                         stderr=subprocess.PIPE,
                        shell=(sys.platform!="win32"))
align=AlignIO.read(child.stdout,"fasta")
outfile=open('c:\Python26\opuntia.phy','w')
AlignIO.write([align],outfile,'phylip')
outfile.close()

I always encounter with these problems

Traceback (most recent call last):
  File "<string>", line 244, in run_nodebug
  File "C:\Python26\muscleIO.py", line 11, in <module>
    align=AlignIO.read(child.stdout,"fasta")
  File "C:\Python26\Lib\site-packages\Bio\AlignIO\__init__.py", line 423, in read
    raise ValueError("No records found in handle")
ValueError: No records found in handle

© Stack Overflow or respective owner

Related posts about subprocess

Related posts about python