Hey :)

You don't even need the python block, as the pymol interpreter is a python interpreter with just some added extras. Single lines of python code are never a problem. This works nicely for me

File test-argv.pml:
================

print sys.argv
for i in sys.argv[1:]: print i


Run pymol:
================

pymol test-argv.pml -- bla bla bla


Output:
================

PyMOL>print sys.argv
['/martini/tsjerk/Programs/pymol-1.5.0.4/pymol.exe', 'bla', 'bla', 'bla']
PyMOL>for i in sys.argv[1:]: print i
bla
bla
bla


Enjoy!

Tsjerk


On Wed, Jun 26, 2013 at 11:21 AM, <lievbuts@vub.ac.be> wrote:
On Wednesday 26 June 2013 08:52:39 Jordan Willis wrote:
> I'm looking to pass a .pml file, do some stuff, and then save it as a
> session. Pymol -c My.pml looks like a good option.  I'm trying to write
> hundreds of sessions each with different arguments. I was wondering if its
> possible to pass command line arguments that can then be seen by the python
> interpreter inside a .pml
>
> While I'm at it, is it easy to pass objects, i.e. variable names, between
> the python enviroment and the pml enviroment inside a .pml script? Is
> cmd.extend the best option? Is there a way to go backwards (from the .pml
> to the python interpreter)?

This .pml sequence works for me:

stored.a = 5
python
import sys
print sys.argv
print stored.a
stored.a = 10
python end
print stored.a

Cheers,

--
Lieven Buts, Postdoctoral Fellow
Structural Biology Brussels, Vrije Universiteit Brussel
Department of Structural Biology, VIB


------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net



--
Tsjerk A. Wassenaar, Ph.D.