[chimera-dev] [Chimera-users] error: from DockPrep import prep

Greg Couch gregc at cgl.ucsf.edu
Mon Mar 14 18:02:09 PDT 2011


(This is really a chimera-dev at cgl.ucsf.edu mailing list question.)

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:

import chimeraInit
chimeraInit.init(nogui=True, silent=True)

before using chimera's modules.

But, in general, you would be better off running those python scripts 
with chimera. For example:

% chimera --nogui --silent script.py

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.

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).

If you want to install other Python packages into chimera's Python that 
have a setup.py file, use:

% chimera --nogui --silent setup.py install

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 http://pypi.python.org/pypi/setuptools for 
details). Right now, chimera is using Python 2.7.

HTH,

Greg

On 03/10/2011 09:34 PM, wascm wrote:
> Dir sir
>
> I try to write a indenpendent python script and run it from command line
>
> some global variables was first set:
>
> export LD_LIBRARY_PATH=/home/wascm/chimera/lib:$LD_LIBRARY_PATH
> export 
> PYTHONPATH=/home/wascm/chimera/share:/home/wascm/chimera/lib:$PYTHONPATH
> export CHIMERA=/home/wascm/chimera
>
> the script work well when import following module
> import chimera
> from chimera import runCommand, openModels, MSMSModel
> from WriteMol2 import writeMol2
> from WriteDMS import writeDMS
> however, when add the code:
> from DockPrep import prep
>
> the error information as follows:
> #######################################
> Traceback (most recent call last):
> File "./xx.py", line 12, in <module>
> from DockPrep import prep
> File "/home/wascm/chimera/share/DockPrep/__init__.py", line 15! , in 
> <module>
> from prefs import prefs, defaults, INCOMPLETE_SC, MEMORIZED_SETTINGS
> File "/home/wascm/chimera/share/DockPrep/prefs.py", line 13, in <module>
> from Rotamers.prefs import defaults as rotamerDefaults
> File "/home/wascm/chimera/share/Rotamers/__init__.py", line 574, in 
> <module>
> from prefs import defaults, CLASH_METHOD, CLASH_THRESHOLD, HBOND_ALLOWANCE
> File "/home/wascm/chimera/share/Rotamers/prefs.py", line 13, in <module>
> from DetectClash.prefs import CLASH_THRESHOLD, HBOND_ALLOWANCE, 
> PB_COLOR, \
> File "/home/wascm/chimera/share/DetectClash/__init__.py", line 157, in 
> <module>
> val = getColorByName(val)
> File "/home/wascm/chimera/share/chimera/colorTable.py", line 87, in 
> getColorByName
> color = chimera.MaterialColor(r/255.0, g/255.0, b/255.0)
> ValueError: mis! sing default material
> #################################################
>
> how can i solve this problem?
>
> best wishes
>
> Tao Cui
>
>
> _______________________________________________
> Chimera-users mailing list
> Chimera-users at cgl.ucsf.edu
> http://www.rbvi.ucsf.edu/mailman/listinfo/chimera-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-dev/attachments/20110314/0ee6d469/attachment.html>


More information about the Chimera-dev mailing list