<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
(This question is a developer question and not a user question, but
since it was asked on chimera-users, the response is there as well.
Followups should go to <a class="moz-txt-link-abbreviated" href="mailto:chimera-dev@cgl.ucsf.edu">chimera-dev@cgl.ucsf.edu</a>.)<br>
<br>
The "ValueError: missing default material" means that the script was
not run by chimera, which we don't support. We also don't support
using an IDLE other than the one you get by running chimera and
using Tools / General Tools / IDLE. <br>
<br>
We only support using chimera's Python code in scripts that are
invoked by chimera. That is why the ringer shell script is:<br>
<br>
"$CHIMERA_HOME"/bin/chimera --nogui --silent --script
"$RINGER"/ringer/main.py -- "$@"<br>
<br>
In the same vein, if you replaced "$RINGER"/ringer/main.py with the
following 2 line script:<br>
<br>
import chimera<br>
print chimera.MaterialColor(1, 1, 1)<br>
<br>
Everything works.<br>
<br>
Long ago, we considered what it would take to get chimera's Python
code working in a different application. In that scenario, you
would need to:<br>
<br>
1. Set the CHIMERA environment variable to the root of the
Chimera installation<br>
2. Set other environment variables that are set in
CHIMERA/bin/chimera for your platform<br>
3. Add $CHIMERA/share to your Python's sys.path<br>
4. import chimeraInit; chimeraInit.init([], nogui=True,
eventloop=False, exitonquit=False)<br>
<br>
But since chimera uses a modified Python, that is insufficient. For
example, chimera changes<br>
Python's default string to unicode conversion to use utf-8 instead
of ASCII. We've also backported some of Python 3's unicode support
that chimera depends on. If you are lucky, your use of chimera's
Python code will not be affected by those changes.<br>
<br>
HTH,<br>
<br>
Greg<br>
<br>
P.S. Your immediate problem might be fixed by calling
chimera.initializeColors(), but that is a hack that is not
guaranteed to keep working.<br>
<br>
<div class="moz-cite-prefix">On 01/16/2015 12:20 PM, Alejandro
Virrueta wrote:<br>
</div>
<blockquote
cite="mid:CAA5EDMSHyhZppriEoe-O=KysTdNU_MwVnhXyZzu6aUyAs3AE3w@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>Hello,</div>
<div><br>
</div>
<div>I am modifying some Ringer files for my own needs, but I am
running into a weird issue. If I run Ringer via typical means:</div>
<div><br>
</div>
$RINGER/ringer/ringer -i ringer_in_${pdb_ID}.txt -o
ringer_out_${pdb_ID}.txt
<div><br>
</div>
<div>it works fine. However, when I step through it in what I
think is my version of IDLE ("$CHIMERA_HOME/bin/chimera
--nogui --nostatus --script `which idle2.7`</div>
<div>/usr/bin/idle2.7", with `which idle2.7` returning
"/usr/bin/idle2.7"), I run into this error:</div>
<div><br>
</div>
<div>Traceback (most recent call last):</div>
<div> File "/Users/av376/ringer-2.0/ringer/main_copy.py", line
233, in <module></div>
<div> main()</div>
<div> File "/Users/av376/ringer-2.0/ringer/main_copy.py", line
161, in main</div>
<div> move_set, pdb = structureFile(parameters, path)</div>
<div> File "/Users/av376/ringer-2.0/ringer/main_copy.py", line
65, in structureFile</div>
<div> pdb = chimera.openModels.open(parameters.pdbfileName)</div>
<div> File
"/Applications/Chimera.app/Contents/Resources/share/chimera/__init__.py",
line 1817, in open</div>
<div> checkForChanges=False, noprefs=noprefs)</div>
<div> File
"/Applications/Chimera.app/Contents/Resources/share/chimera/__init__.py",
line 1644, in add</div>
<div> makePseudoBondsToMetals(realMolecules)</div>
<div> File
"/Applications/Chimera.app/Contents/Resources/share/chimera/__init__.py",
line 1961, in makePseudoBondsToMetals</div>
<div> cmPBG = mol.metalComplexGroup(issueHint=True)</div>
<div> File
"/Applications/Chimera.app/Contents/Resources/share/chimera/__init__.py",
line 119, in _getMetalPbg</div>
<div> am.color = preferences.get(MOLECULE_DEFAULT,
MOL_COMPLEX_COLOR)</div>
<div> File
"/Applications/Chimera.app/Contents/Resources/share/chimera/preferences/base.py",
line 608, in get</div>
<div> forPrefSave=forPrefSave)</div>
<div> File
"/Applications/Chimera.app/Contents/Resources/share/chimera/preferences/base.py",
line 179, in get</div>
<div> return self._options[name].get(forPrefSave=forPrefSave)</div>
<div> File
"/Applications/Chimera.app/Contents/Resources/share/chimera/preferences/base.py",
line 80, in get</div>
<div> return self.prefToVal(self.value)</div>
<div> File
"/Applications/Chimera.app/Contents/Resources/share/chimera/tkoptions.py",
line 1229, in _prefToColor</div>
<div> return getColorByName(pref)</div>
<div> File
"/Applications/Chimera.app/Contents/Resources/share/chimera/colorTable.py",
line 87, in getColorByName</div>
<div> color = chimera.MaterialColor(r/255.0, g/255.0,
b/255.0)</div>
<div>ValueError: missing default material</div>
<div><br>
</div>
<div>Any suggestions?</div>
<div><br>
</div>
<div>Cheers,</div>
<div>Alex</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Chimera-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Chimera-users@cgl.ucsf.edu">Chimera-users@cgl.ucsf.edu</a>
<a class="moz-txt-link-freetext" href="http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users">http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users</a>
</pre>
</blockquote>
<br>
</body>
</html>