[Chimera-users] Python command SaveReplyLog
pett at cgl.ucsf.edu
Mon Aug 8 11:07:42 PDT 2011
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.
'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'
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.
UCSF Computer Graphics Lab
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Chimera-users