On Aug 8, 2011, at 12:45 AM, Damien Larivière wrote:
Dear all,
Within a loop for i in range(1, 5), I would like to save the Reply Log in text file in a specific location.
My script fails when I use such syntax, saying Unrecognized command:
from chimera.tkgui import saveReplyLog
rc("saveReplyLog('C:\Program Files (x86)\Hex 6.3\examples\replyLog%d.txt')" % i)
I looked at old posts saying the syntax to be saveReplyLog('path') but it does not work.
May you tell me what is wrong with it? I can post the whole script if necessary.
Hi Damien,
'saveReplyLog' is a Python function, not a Chimera command. Therefore, it should be used directly rather than inside an rc() call. So, like this:
from chimera.tkgui import saveReplyLog
saveReplyLog(r'C:\Program Files (x86)\Hex 6.3\examples\replyLog%d.txt' % i)
Note the 'r' in front of the 'C:\Program Files\...' string. This tells Python not to treat the backslashes in the string specially (i.e. treat it as a "raw" string). Otherwise you would need to use two backslashes in a row every place you wanted one.
--Eric