Hi
I'm writing a short script to use pymol to generate "ideal" alpha
helices out of arbitrary sequences. I use a short script, BuildHelix.py:
from pymol import cmd, stored
def BuildMe(sequence):
cmd.set("secondary_structure",1.00)
for aa in sequence: cmd._alt(string.lower(aa))
cmd.save(sequence+".pdb")
cmd.extend( "BuildMe", BuildMe )
I can then run this from the gui prompt, or in interactive mode without
the gui without issue, as follows:
run BuildHelix.py
BuildMe("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")
quit
However, as I want to use this in an automated way, I have been trying
this command:
echo 'run
BuildHelix.py\nBuildMe("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")\nquit\n)' |
pymol -xpic
This works intermittently, roughly 1 in 3 or 4 times. Adding cmd.sync()
lines to either the script or the command doesn't change the results.
However, if I use the command "quit()" (rather than "quit"), pymol
crashes with an error in threading.py and the file is correctly written
out. The error given is
PyMOL>quit()
Traceback (most recent call last):
File "/var/lib/python-support/python2.5/pymol/parser.py", line 456, in
parse
exec(layer.com2+"\n",self.pymol_names,self.pymol_names)
File "<string>", line 1, in <module>
File "site.py", line 256, in __call__
raise SystemExit(code)
SystemExit: None
Exception in thread Thread-1:
Traceback (most recent call last):
File "threading.py", line 460, in __bootstrap
self.run()
File "threading.py", line 440, in run
self.__target(*self.__args, **self.__kwargs)
File "/var/lib/python-support/python2.5/pymol/parser.py", line 500, in
stdin_reader
l = sys.stdin.readline()
ValueError: I/O operation on closed file
I'm running version 1.0re1, though I have also tested with 0.98.
Any advice would be much appreciated. Thanks in advance
Ben Hall