<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Mar 15, 2011, at 5:37 AM, wascm wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Dear sir:<br><br>Thanks for the detailed reply!<br><br>When the following code was added to the start of sciprt:<br><br><i>import chimeraInit<br>chimeraInit.init(nogui=True, silent=True)</i><br><br>The interpreter print the following confused error: <br><br>---------------------------------------------<br><i>Traceback (most recent call last):<br> File "./xx.py", line 5, in <module><br> chimeraInit.init(nogui=True, silent=True)<br>TypeError: init() takes at least 1 argument (2 given)</i><br></blockquote><div><br></div>There was an oversight in the code Greg provided: chimeraInit.init takes a mandatory "argv" argument, which is exactly like sys.argv.</div><div><br><blockquote type="cite">-----------------------------------------------<br><br>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.<br><br>For example, when i run some command like this:<br><br>chimera –nogui test.py -t test<br><br>test.py<br>################### <br>#!/usr/bin/python<br><br>t=None<br><br>try:<br> opts, args = getopt.getopt(sys.argv[1:], "t:")<br>except getopt.GetoptError, err: <br> pass<br>finally: <br> for arg_k, arg_v in opts:<br> if (arg_k =="-t"): t=arg_v<br>####################################<br><br>This will raise running exception!<br><br>is there a way for me to add the coustom option to python script and run the script with chimera?</blockquote><br></div><div>Yes. Use a --script argument, like this:</div><div><br></div><div>chimera --nogui --script "test.py -t test"</div><div><br></div><div>--Eric</div><div><br></div><br></body></html>