chavanak 0 Newbie Poster

Hi,
I have written a python script that acts as a wrapper around an executable. Here is the code:

import os
import sys
import string
import csv
usage = "usage: Specify the directories for files and the RDOCK cut-off value"

if len(sys.argv) < 4:
    print usage
    sys.exit()
else:
    first_folder = sys.argv[1]
    second_folder = sys.argv[2]
    rdock_cutoff = sys.argv[3]
print rdock_cutoff
myfileobj = open("rdock.txt","r")
csv_read = csv.reader(myfileobj,dialect=csv.excel_tab)
myval1 = []
myval2=[]
for line in csv_read:
    if line[0][0]=="R":
        pass
    else:
        myval1.append(line[1])
myval1=myval1[:50]

myfileobj = open("rdock_nav.txt","r")
csv_read = csv.reader(myfileobj,dialect=csv.excel_tab)
myval2=[]
for line in csv_read:
    if line[0][0]=="R":
        pass
    else:
        myval2.append(line[1])
myval2=myval2[:50]
#print myval2

for i in myval1:
    for j in myval2:
        [B]print "The First Complex is:", first_folder+"complex."+i
        print "The Second Complex is:", second_folder+"complex."+j
        os.system("./TMscore %s %s"%(first_folder+"complex."+i, second_folder+"complex."+j))[/B]

The script is supposed to print the name of the file1 and file2 before starting the TMscore. But when I pipe the output to a text file, the print statements are completely ignored. So is there a way to capture the complete std.out to a file? If so can someone help me out?

The format I am expecting is:

The First Complex is: complex.xxx
The Second Complex is: complex.yyy
TMscore output

The First Complex is: complex.aaa
The Second Complex is: complex.bbb
TMscore output
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.