When I run my script in bash, I get the error: sh: 2: Syntax error: "|" unexpected. I don't know why, I want to use pipelines here, and a script in perl with that command works, but I need it in Python.
Example of input (text file):
Kribbella flavida
Saccharopolyspora erythraea
Nocardiopsis dassonvillei
Roseiflexus sp.
Script:
#!/usr/bin/python
import sys import os
input_ = open(sys.argv[1],'r') output_file = sys.argv[2]
#stopwords = open(sys.argv[3],'r')
names_board = []
for name in input_:
names_board.append(name.rstrip())
print(name) for row in names_board:
print(row)
os.system("esearch -db pubmed -query %s | efetch -format xml | xtract -pattern PubmedArticle -element AbstractText >> %s" % (name,
output_file))
os.systemwithprint? Does that look reasonable?man esearch,man efetch, andman xtract?