Hi,

I have a script that uses PyMOL to aid with a lot of calculations. So,
I run the script like this:

pymol -c script.py

The script has grown so that it has a lot of options. Right now, I
edit the script every time I want to change them. If it were a normal
Python script, I'd run it like

script.py --do=something --when=now

Is there a standard way to do this via PyMOL? Ideally, I'd like to say

pymol -qcr script.py --do=something --when=now
and have script.py think that sys.argv == ['script.py',
'--do=something', '--when=now'].

I pawed through pymol.invocation.py, and it looks like PyMOL respects
the convention where it won't parse arguments after a '--', so my
current workaround is to launch things like

pymol -qcr script.py -- -do=something --when=now

and then this in my script:

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

So, is there a more standard way of doing this? If not, hopefully
google will find this for me the next time I have this question :).

Thanks,

-Michael
-- 
Biophysics Graduate Student
Carlson Lab, University of Michigan
http://www.umich.edu/~mlerner

Reply via email to