[Chimera-users] Importing Midas within non-Chimera python installation

Greg Couch gregc at cgl.ucsf.edu
Thu Mar 5 13:10:55 PST 2009

On Thu, 5 Mar 2009, Drew Bryant wrote:

> Hello,
> As part of a larger python-based project I'm working on, I need to do
> automated image generation with Chimera.  How can the Midas module (no
> need for any gui components) be imported into a non-chimera
> installation of python?  I think this is a little more complicated
> than just setting the PYTHONPATH to point at the chimera files,
> because of the compiled shared objects.  For example, my attempt at
> importing Midas (after adding CHIMERA/share   to the PYTHON PATH)
> raises:
> /home/dbryant/CHIMERA/share/Midas/__init__.py in <module>()
> /home/dbryant/CHIMERA/share/chimera/__init__.py in <module>()
> <type 'exceptions.ImportError'>: libgfxinfo.so: cannot open shared
> object file: No such file or directory
> Currently I'm using a non-gui daily build of Chimera for 64-bit Linux
> and calling the chimera binary via the shell (which works), but I need
> to be able to pass parameters to the script being run at the command
> line.
> Thanks,
> Drew Bryant

To import chimera modules into a non-chimera installation of python, you 
need to set the CHIMERA environment variable and then import the 
chimeraInit module and call chimeraInit.init([]).  In your case, you 
shouldn't need any keyword arguments to the init function, but if you were 
using the GUI version, then eventloop=False would very useful.

 	Good luck!

 	Greg Couch
 	UCSF Computer Graphics Lab

More information about the Chimera-users mailing list