On Jul 17, 2010, at 6:33 AM, Jean Didier Pie Marechal wrote:

Hi everyone,

I want to write  only a part of the reply log in a file. I was trying to use the script you gave to katrina months ago but I have a problem in parsing the reply log text output.
If I understand correctly the reply log text is a raw text. I'd like to parse it in "lines" and then only write in the output file a intersting bit, like for example lines that contains "RMSD". I thought it would be enough to split text using the '\n' return character but that does not work. Could you give me a hand please? 

Best

JD

def save_reply_log(path):
  from chimera import dialogs
  r = dialogs.find('reply')
  text = r.text.get('1.0', 'end')
  f= open(path, 'w')
  i=text.split("\n")
  f.close()

save_reply_log("d:/tmplog.txt")

Hi JD,
I think your function would be written as:

def save_reply_log(path):
from chimera import dialogs
r = dialogs.find('reply')
text = r.text.get('1.0', 'end')
f = open(path, 'w')
for line in text.splitlines():
if "RMSD" in line:
print>>f, line
f.close()

--Eric