Hi all,
I'd like to execute pymol like: pymol -c script.py arg1 arg2 arg3 arg4.

(1) Reading into PyMolWiki
http://www.pymolwiki.org/index.php/Scripting, I've learned that I have
to type:

pymol -c script.py -- arg1 arg2 arg3 arg4

and then add to my script:

from sys import argv
my_argv =3D argv[argv.index("--"):]
print my_argv[1], my_argv[2]

But it doesn work!

"Traceback (most recent call last):
File "/home/campa/SOFTWARE/pymol/modules/pymol/parser.py", line 285, in parse
    parsing.run_file(exp_path(args[nest][0]),pymol_names,pymol_names)
File "/home/campa/SOFTWARE/pymol/modules/pymol/parsing.py", line 407,
in run_file
    execfile(file,global_ns,local_ns)
File "rotamermod3.py", line 45
     my_argv =3D argv[argv.index("--"):]
               ^
 SyntaxError: invalid syntax"

(2) Then I found an alternatively procedure
http://sourceforge.net/mailarchive/message.php?msg_id=e4c539ed0708011206nf6dc1a1r257f7311f42aa59e%40mail.gmail.com

Identical command: pymol -c script.py -- arg1 arg2 arg3 arg4

But I have to add into my script.py the following:

argv = sys.argv[sys.argv.index('--') + 1:]
options,args = parser.parse_args(args=argv)

But it doesn't work neither:
AttributeError: 'module' object has no attribute 'argv'

Can someone give a light in how to call arguments in pymol -c script.py?

Thanks a lot,

Josep Maria Campanera,

Reply via email to