It looks like Andrey wants his script to be able to interpret command
line arguments.  Unfortunately, PyMOL doesn't enable this in a
consistent way, since Launching under Windows (embedded Python) is quite
different than unix (non-embedded Python).

With embedded Python, arguments aren't making it to sys.argv.  Instead,
they are being passed straight from C into PyMOL's invocation routine.
I will fix this in the next version by reassigning them to sys.argv, but
you can do this immediate by inserting

   import sys
   sys.argv = copy.deepcopy(argv)

Directly under "def parse_args(argv):" (line 79) in
PyMOL/modules/pymol/invocation.py.  

I'd also like to provide a means by which certain can be ignored by
PyMOL and be available directly to Python scripts in PyMOL.

Here is my proposal:  

Ignore any arguments after a double-hyphen ("--") sentinel.  For
example:

pymol -c myscript.py -- -pymol -will -ignore -these -arguments
pymol -c myscript.py -- -your -script -interpret -them -instead

Any objections? 

- Warren


--
mailto:war...@sunesis.com
Warren L. DeLano, Ph.D.
Informatics Scientist
Sunesis Pharmaceuticals, Inc.
341 Oyster Point Blvd.
S. San Francisco, CA 94080
(650)-266-3606 fax: (650)-266-3501

> From: Frank Vondelft 
> 
> Andrey,
> 
> I deduce you're referring to windows?  I think this is what 
> you get when python gets installed in C:\Program Files\python 
> or some other location that is not on the (hardcoded?) search 
> path of pymol, which means it can't find the tcltk libraries. 
>  The solution is to install python on C:\python, and 
> everything is hunky-dory -- I think you don't even have to 
> reinstall pymol, but you can check that, it doesn't take long. 
> 
> Good luck
> phx.
> 

> From: Andrey Khavryuchenko
> 
> Hi!
> 
> Is it only me who gets the following:
> 
> for i in argv:
>     print i
> 
> [...]
> 
> $ pymol -c mov.py
> [...]
>  Hit ESC anytime to toggle between text and graphics.
> 
>  Command mode. No graphics front end.
> Traceback (most recent call last):
>   File "C:\Program Files\DeLano 
> Scientific\PyMOL/modules\pymol\parser.py", lin
> e 174, in parse
>     execfile(args[nest][0],pymol_names,pymol_names)
>   File "mov.py", line 90, in ?
>     for i in sys.argv:
> AttributeError: 'sys' module has no attribute 'argv'
>  Memory: 0 blocks expected, 0 found, 42 maximum allocated.
> 
> Linux version and plain python under winnt are ok.  It's only 
> pymol that
> gives that strange behaviour.
> 
> -- 
> Andrey V Khavryuchenko          http://www.kds.com.ua/
> Offshore Software Development
> 
> _______________________________________________
> PyMOL-users mailing list
> PyMOL-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pymol-users
> 
> 
> 

Reply via email to