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

wascm wascm at 126.com
Tue Mar 15 17:24:04 PDT 2011


Dear sir:
 
Your suggestions do work well! The problems have been resolved well by your help. 
 
Thank you very much!
 
Best Wishes
 
Tao Cui 




From:Eric Pettersen
Date:2011-03-16 05:12
Subject:Re: [chimera-dev] [Chimera-users] error: from DockPrep import prep
To:wascm
Cc:Greg Couch,chimera-dev BB,UCSF Chimera Mailing List

On Mar 15, 2011, at 5:37 AM, wascm wrote:


Dear sir:

Thanks for the detailed reply!

When the following code was added to the start of sciprt:

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

The interpreter print the following confused error: 

---------------------------------------------
Traceback (most recent call last):
 File "./xx.py", line 5, in <module>
 chimeraInit.init(nogui=True, silent=True)
TypeError: init() takes at least 1 argument (2 given)



There was an oversight in the code Greg provided:  chimeraInit.init takes a mandatory "argv" argument, which is exactly like sys.argv.


-----------------------------------------------

it's really easy and convenient to running python script with chimera. The reason for i want to run python script independently is that i want add some custom command option. However, if i run python script with chimera, it's hard for me to add some custom command option and handle it in the script though getopt module.

For example, when i run some command like this:

chimera –nogui test.py -t test

test.py
################### 
#!/usr/bin/python

t=None

try:
    opts, args = getopt.getopt(sys.argv[1:], "t:")
except getopt.GetoptError, err: 
    pass
finally: 
    for arg_k, arg_v in opts:
        if (arg_k =="-t"): t=arg_v
####################################

This will raise running exception!

is there a way for me to add the coustom option to python script and run the script with chimera?


Yes.  Use a --script argument, like this:


chimera --nogui --script "test.py -t test"


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


More information about the Chimera-dev mailing list