<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=x-gbk" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
(This is really a <a class="moz-txt-link-abbreviated" href="mailto:chimera-dev@cgl.ucsf.edu">chimera-dev@cgl.ucsf.edu</a> mailing list question.)<br>
<br>
My guess is that your problem is that chimeraInit.init() was never
called, so the chimera internals were never set up. So in the
beginning of your Python script, add:<br>
<br>
import chimeraInit<br>
chimeraInit.init(nogui=True, silent=True)<br>
<br>
before using chimera's modules.<br>
<br>
But, in general, you would be better off running those python
scripts with chimera. For example:<br>
<br>
% chimera --nogui --silent script.py<br>
<br>
That would set up the the appropriate environment for chimera,
execute the python script, and exit. And you would be protected
against any future changes in how chimera is initialized.<br>
<br>
If you want to use other Python modules with chimera, set your
CHIMERAPATH environment variable with a list of directories that
hold the Python modules (same syntax as PYTHONPATH, but just for
chimera).<br>
<br>
If you want to install other Python packages into chimera's Python
that have a setup.py file, use:<br>
<br>
% chimera --nogui --silent setup.py install<br>
<br>
It is also possible to make easy_install work with chimera by
temporarily putting chimera's bin directory on your path and running
the appropriate egg (see <a
href="http://pypi.python.org/pypi/setuptools">http://pypi.python.org/pypi/setuptools</a>
for details). Right now, chimera is using Python 2.7.<br>
<br>
HTH,<br>
<br>
Greg<br>
<br>
On 03/10/2011 09:34 PM, wascm wrote:
<blockquote
cite="mid:6b19481b.5775.12ea3685a68.Coremail.wascm@126.com"
type="cite">Dir sir<br>
<br>
I try to write a indenpendent python script and run it from
command line<br>
<br>
some global variables was first set:<br>
<br>
export LD_LIBRARY_PATH=/home/wascm/chimera/lib:$LD_LIBRARY_PATH<br>
export
PYTHONPATH=/home/wascm/chimera/share:/home/wascm/chimera/lib:$PYTHONPATH<br>
export CHIMERA=/home/wascm/chimera<br>
<br>
the script work well when import following module<br>
import chimera<br>
from chimera import runCommand, openModels, MSMSModel<br>
from WriteMol2 import writeMol2<br>
from WriteDMS import writeDMS<br>
however, when add the code:<br>
from DockPrep import prep<br>
<br>
the error information as follows:<br>
#######################################<br>
Traceback (most recent call last):<br>
File "./xx.py", line 12, in <module><br>
from DockPrep import prep<br>
File "/home/wascm/chimera/share/DockPrep/__init__.py", line 15!
, in <module><br>
from prefs import prefs, defaults, INCOMPLETE_SC,
MEMORIZED_SETTINGS<br>
File "/home/wascm/chimera/share/DockPrep/prefs.py", line 13, in
<module><br>
from Rotamers.prefs import defaults as rotamerDefaults<br>
File "/home/wascm/chimera/share/Rotamers/__init__.py", line 574,
in <module><br>
from prefs import defaults, CLASH_METHOD, CLASH_THRESHOLD,
HBOND_ALLOWANCE<br>
File "/home/wascm/chimera/share/Rotamers/prefs.py", line 13, in
<module><br>
from DetectClash.prefs import CLASH_THRESHOLD,
HBOND_ALLOWANCE, PB_COLOR, \<br>
File "/home/wascm/chimera/share/DetectClash/__init__.py", line
157, in <module><br>
val = getColorByName(val)<br>
File "/home/wascm/chimera/share/chimera/colorTable.py", line 87,
in getColorByName<br>
color = chimera.MaterialColor(r/255.0, g/255.0, b/255.0)<br>
ValueError: mis! sing default material<br>
#################################################<br>
<br>
how can i solve this problem?<br>
<br>
best wishes<br>
<br>
Tao Cui <br>
<br>
<span title="neteasefooter"><span id="netease_mail_footer"></span></span>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
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://www.rbvi.ucsf.edu/mailman/listinfo/chimera-users">http://www.rbvi.ucsf.edu/mailman/listinfo/chimera-users</a>
</pre>
</blockquote>
<br>
</body>
</html>