[Chimera-users] chimera --nogui --script option not doing anything!

Eric Pettersen pett at cgl.ucsf.edu
Tue Nov 27 10:31:41 PST 2018

Hi Ahir,
	I think the issue is that in nogui mode, print statements and status messages go to “standard output” and on Window standard output is, um, well — I don’t really know what it is on Windows.  I think the simplest solution is to send your print/status statements to a file and monitor that file to check on progress.  So near the top of the file do something like this:

outf = open(“C:/my-home-folder/output.txt”, “w”)

and change print “x” and replyobj.status(“x”) to:

print>>outf, “x”

you may need to do outf.flush() to get the print statements into the file immediately (otherwise they may be buffered up to be written later).


	Eric Pettersen
	UCSF Computer Graphics Lab

> On Nov 27, 2018, at 8:03 AM, Ahir Pushpanath <ahir29 at gmail.com> wrote:
> Dear Chimera crew, 
>                      I am having serious trouble running my script using chimera --nogui --script option. I tried running a simple script that just prints a comment, and i dont get anything returned on the cmd, let alone the actual script. 
> The cmd does not flag up any errors , it just does nothing and return back to the prompt.
> I have chimera 1.13.1 and its added to the system path - "C:\Program Files\Chimera 1.13.1rc\bin\". I can launch chimera fine from the command line showing its added to path fine.
> I am completely stumped! Also, the script works fine within the IDLE of the GUI.
> See code below:
> import os
> print "Script is running"
> from chimera import runCommand as rc # use 'rc' as shorthand for runCommand
> from chimera import replyobj # for emitting status messages
> # change to folder with data files
> os.chdir("C:/Users/JM/Documents/Public Qsync/Jenny Taylor/IREDs/Structures/")
> # gather the names of .pdb files in the folder
> file_names = [fn for fn in os.listdir(".") if fn.endswith(".pdb")]
> # loop through the files, opening, processing, and closing each in turn
> for fn in file_names:
>         res = "tyr"
>         if fn == ""2NAD.pdb":
>                 print fn
>                 replyobj.status("Processing " + fn) # show what file we're working on
>                 rc("open " + fn)
>                 for b in range(1,300):
>                         rc("sel #0" + ":"+str(b))
>                         rc ("swapaa "+res + " sel criteria p")
>                         rc ('write format pdb #0'+ " " + fn +"_"+res+'mutated.pdb')
>         rc("close all")
> # uncommenting the line below will cause Chimera to exit when the script is done
> rc("stop now")
> -- 
> Dr. Ahir Pushpanath PhD.
> Senior Biologist,
> Johnson Matthey.
> _______________________________________________
> Chimera-users mailing list: Chimera-users at cgl.ucsf.edu
> Manage subscription: http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20181127/f18a57ac/attachment.html>

More information about the Chimera-users mailing list