Takefumi,

# If launching PyMOL from an external interpreter, then you need 
# these two lines first:

import pymol
pymol.finish_launching()

# If using PyMOL directly, then start here...

from pymol import cmd

# A command like the following

cmd.do("show cartoon")

# is essentially equivalent to:

cmd.show("cartoon")

# end example script

Now, if you save the above in a script.py file, you can 

python script.py

assuming that PyMOL has been installed as a Python module.
 
If using a standalone version of PyMOL, then for synchronous execution,
issue:

pymol script.py
(equivalent to "run script.py" from within PyMOL)

or for asynchronous execution, issue:

pymol -l script.py
(equivalent to "spawn script.py" from within PyMOL)

On Windows use "(pymol-install-path)\pymolwin.exe" instead of "pymol".

Hopefully that answers your question : ).  Sorry for the complexity, but
that's the price of flexibility.

Cheers,
Warren

--
mailto:war...@delanoscientific.com
Warren L. DeLano, Ph.D.
Principal Scientist
DeLano Scientific LLC
Voice (650)-346-1154 
Fax   (650)-593-4020

> -----Original Message-----
> From: pymol-users-ad...@lists.sourceforge.net [mailto:pymol-users-
> ad...@lists.sourceforge.net] On Behalf Of Takefumi Sora
> Sent: Wednesday, January 21, 2004 8:42 AM
> To: pymol-users@lists.sourceforge.net
> Subject: [PyMOL] How to send pymol command to pymol by python
interpreter
> 
> 
> Dear Pymol users
> 
> I launch Pymol in my python program.
> After that, I can't change objects in pymol in my
> python program. In short I do not know how to
> send pymol command (ex cmd.do("show cartoon")) to
> Pymol not by directly input in pymol external command line
> but by python interpreter.
> 
> Does anybody know how to do this ?
> 
> Thank you.
> Takefumi SORA
> 
> 
> 
> -------------------------------------------------------
> The SF.Net email is sponsored by EclipseCon 2004
> Premiere Conference on Open Tools Development and Integration
> See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
> http://www.eclipsecon.org/osdn
> _______________________________________________
> PyMOL-users mailing list
> PyMOL-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pymol-users



Reply via email to