[chimera-dev] chimera import from unmodified python 2.5

Eric Pettersen pett at cgl.ucsf.edu
Wed Aug 13 14:17:10 PDT 2008


                         Eric Pettersen
                         UCSF Computer Graphics Lab
                         http://www.cgl.ucsf.edu


On Aug 9, 2008, at 1:51 PM, Ondrej Marsalek wrote:

>> And yes, please share how you are using chimera with the stock  
>> python. It
>> should be as "simple" as (1) setting the CHIMERA environment  
>> variable, (2)
>> adding CHIMERA/lib to LD_LIBRARY_PATH, (3) optionally setting up  
>> Tcl and Tk
>> to be chimera's version, (4) adding CHIMERA/share to sys.path, (3)  
>> importing
>> chimeraInit, and (5) calling chimeraInit.init with either  
>> nogui=True or
>> eventloop=False.
>
> i have the following chimera.env file that i source in bash:
>
> export CHIMERA=/opt/chimera
> export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CHIMERA/lib
> export PYTHONPATH=$PYTHONPATH:$CHIMERA/share:$CHIMERA/lib:$CHIMERA/ 
> lib/python2.5/site-packages
>
> the nogui version works, but that is not exactly what i wanted, as
> that provides a midas prompt (if i understand it correctly). i would
> rather like to stay in my original python shell (ipython in this
> case). is there a way to do that?

Here's what works for me:

env CHIMERA=/usr/local/chimera.dev LD_LIBRARY_PATH=/usr/local/ 
chimera.dev/lib PYTHONPATH=/usr/local/chimera.dev/share:/usr/local/ 
chimera.dev/lib:/usr/local/chimera.dev/lib/python2.5/site-packages  
python2.5

You will have to adjust the above to your local installation, and may  
want to include the original values of LD_LIBRARY_PATH and PYTHONPATH  
if they are normally non-empty for you (i.e. in a similar fashion to  
your original export statements).

At the resulting python prompt:

from chimeraInit import init
init([], nogui=True, script="py:/dev/null")

The "script=" keyword arg prevents Chimera from giving you it's own  
command prompt since you are tricking it into believing that you've  
provided a script to execute (/dev/null is always an empty file).   
Alternatively, you could have just typed "stop" at the prompt that  
Chimera gave you and gotten back to the python prompt.

--Eric

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


More information about the Chimera-dev mailing list