2021年2月7日星期日

How to input a couple of arguments using Popen.communicate?

I have installed the Vienna package to use it with a Python program. I was using an instruction called RNAcofold that allows the input of two sequences joined by &. The program I made is the following:

rna1="GCGCUUCG&CCGCGCGCC"  p = subprocess.Popen('RNAcofold.exe', stdin=PIPE,stdout=PIPE,shell=True,                       env={'PATH': 'D:\\ViennaRNAPackage'})  answer = p.communicate(rna1.encode())  

The problem that I have is when I want to use another command, but this one uses two arguments; something like this:

rna1="GCGCUUCGCCGCGCGCC"  rna2="GCGCUUCGCCGCGCGCA"  p = subprocess.Popen('RNAduplex.exe', stdin=PIPE,stdout=PIPE,shell=True,                       env={'PATH': 'D:\\ViennaRNAPackage'})    answer = p.communicate(rna1.encode(),rna2.encode())  print (answer)  

and it gives me the following error:

TypeError: unsupported operand type(s) for +: 'float' and 'bytes'  

The question that I have is: How can I communicate with this program if it receives two arguments? When I use it in the cmd prompt I should enter each sequence in a different line.

https://stackoverflow.com/questions/66094627/how-to-input-a-couple-of-arguments-using-popen-communicate February 08, 2021 at 08:47AM

没有评论:

发表评论