[Chimera-users] Question About Using Chimera In Python Scripts with Other Features

Greg Couch gregc at cgl.ucsf.edu
Mon Apr 28 16:01:00 PDT 2014


  So the answer is that in theory it is possible.  It is easier on Linux 
and Mac OS X, but not impossible on Windows.  In all cases, it is easier 
to put other Python modules into Chimera than the other way around.  
Then run the Python script using Chimera with the open command or the 
File / Open menu item.

The first thing to try is to set the CHIMERAPATH environment variable 
(like PYTHONPATH, but just for Chimera), to point to the directory (or 
directories) with the modules from the other program.  There is a high 
chance of conflicts with Chimera modules, but if it works, you're done.  
To set environment variables on Windows, go to the Control Panel / 
System / Advanced system settings / Environment Variables and create the 
CHIMERAPATH environment variable.

The next option is to use CHIMERAPATH pointing to a new directory where 
you copy just what you need.  This might be needed anyway if there are 
file permission problems with the first approach.

Lastly, specially for Windows, my heavy handed approach that I 
occasionally use for testing: As the administrator: (1) change the 
ownership of the Chimera installation to be yourself, then (2) copy the 
modules you need from the other program to 
CHIMERA\bin\Lib\site-packages\.  In this case, you can edit the Chimera 
Python files if needed to get things to work.

     HTH,

     Greg

On 04/26/2014 01:13 PM, John Dougherty wrote:
> Hello,
> I am not very computer savvy and very new to programming. I am using 
> Windows 7, Python 2.7.3 32 bit
> I would like to know if it is possible to use features from Chimera in 
> a python script. For example:
>
> from chimera import *
> from otherprogram import *
>
> otherprogram stuff
> runCommand('blah blah blah')
>
>
> Chimera does some things the other program does not and vice versa. My 
> life would be made much easier if I could just integrate them into one 
> script.
>
> I do not understand the instructions about this matter which are 
> posted on the FAQs on the website.
>
> Sincerely,
>
>
> -- 
> John J. Dougherty III
> Biomathematics Major
> Rutgers, New Brunswick
> (P) 856 981 9491




More information about the Chimera-users mailing list