Stuart,
Hmm...it appear that QuietException is being thrown when the input pattern
fails to match any valid object name (but without an error message being
printed).
The easiest immediate workaround is to simply swallow the exception.
for i in range(10):
try:
cmd.color(colors[i], "sym0" + str(i) + "*")
except cmd.QuietException:
pass
Cheers,
Warren
________________________________________
From: Stuart Ballard [mailto:[email protected]]
Sent: Wednesday, August 26, 2009 4:35 PM
To: pymol-users
Subject: [PyMOL] Inexplicable exception raised by cmd.color()
Hello Warren, all,
When attempting to execute this block of code:
colors =
["red","orange","yellow","green","blue","purple","salmon","grey","pink","teal","brown"]
for i in range(10):
cmd.color(colors[i], "sym0" + str(i) + "*")
The following error message is displayed:
Traceback (most recent call last):
File
"/Users/delwarl/MacPyMOL090405/build/Deployment-py25/MacPyMOL.app/pymol/modules/pymol/parser.py",
line 153, in parse
File "<string>", line 3, in <module>
File
"/Users/delwarl/MacPyMOL090405/build/Deployment-py25/MacPyMOL.app/pymol/modules/pymol/viewing.py",
line 2425, in color
QuietException: <pymol.parsing.QuietException instance at 0x104ea698>
Furthermore, the object corresponding to sym00* is colored red, as expected.
I've looked up the code in parser.py and viewing.py which generates the
exception itself, and that has shed no light. Function color in viewing.py is
as follows:
# preprocess selection
selection = selector.process(selection)
color = _self._interpret_color(_self,str(color))
#
r = DEFAULT_ERROR
try:
_self.lock(_self)
r =
_cmd.color(_self._COb,str(color),str(selection),int(flags),int(quiet))
finally:
_self.unlock(r,_self)
if _self._raising(r,_self): raise QuietException
return r
Any explanation of the bug, or an effective workaround would be greatly
appreciated.
Thanks,
Stuart Ballard
Dept. of Biochemistry
UW-Madison
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
PyMOL-users mailing list ([email protected])
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/[email protected]