Stuart,
I tried to replicate your problem. But, it worked as expected for me,
so I'm thinking it might come down to your object names.
Try this. Copy this into your PyMOL (or save it to a file and run it);
does it work for you?
#
# color_example.py
#
# make 20 fake objects & splay them out
for x in range(20): cmd.pseudoatom( "sym0" + str(x) + "foo" )
for x in range(20): cmd.translate( [2*x, 0, 0], "sym0" + str(x) + "foo")
# change repr
cmd.show_as("spheres")
cmd.zoom("vis")
# define colors
colors = [ "red", "orange", "yellow", "green", "blue", \
"purple","salmon", "grey", "pink", "teal", "brown"]
# color them
for i in range(len(colors)):
cmd.color(colors[i],"sym0"+str(i)+"*",quiet=0)
It should show 20 spheres, where 11 are colored the same and rest brown.
-- Jason
> [PyMOL] Inexplicable exception raised by cmd.color()
> From: Stuart Ballard <srball...@wi...> - 2009-08-26 23:32
>
> Attachments: Message as HTML
> 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
--
Jason Vertrees, PhD
PyMOL -- http://www.pymol.org/
PyMOLWiki -- http://www.pymolwiki.org/
------------------------------------------------------------------------------
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]