> Is there some recommended way to run a file of code?

Gilleain is right on about the run command.  On Windows and linux, you
can also create .pym files that will specifically open into PyMOL.

Another alternative is to use Python import capability.

And of course, within pml files you can use blocks with explicit
continuation lines:

if a == b: \
    for c in range(1,10): \
       print c

etc.

--
Warren L. DeLano, Ph.D.                     
Principal Scientist

. DeLano Scientific LLC  
. 400 Oyster Point Blvd., Suite 213           
. South San Francisco, CA 94080 USA   
. Biz:(650)-872-0942  Tech:(650)-872-0834     
. Fax:(650)-872-0273  Cell:(650)-346-1154
. mailto:war...@delsci.com      
 

> -----Original Message-----
> From: pymol-users-ad...@lists.sourceforge.net 
> [mailto:pymol-users-ad...@lists.sourceforge.net] On Behalf Of 
> Terry Jones
> Sent: Monday, October 03, 2005 5:03 AM
> To: pymol-users@lists.sourceforge.net
> Subject: [PyMOL] Using the Pymol Run command
> 
> Hi all
> 
> I've written some python code that I want to run from inside 
> pymol using the File/Run command. After some playing around 
> looking at error messages and the pymol source, I saw that 
> pymol is reading my file line by line and passing each line to eval.
> 
> So if my file contains lines that are each complete python 
> commands, File/Run works fine. But if it contains python like
> 
>   if a == b:
>     pass
> 
> then File/Run fails with a syntax error (as eval falls over 
> when it is passed just the first line).
> 
> While I can see an obvious (and ugly) way to work around 
> this, I wanted to first ask if there is another way to do 
> what I'm trying to achieve. Without trying to understand too 
> much of the pymol source, I can see it does use execfile 
> under some circumstances. Is there some recommended way to 
> run a file of code? Maybe my code should simply call execfile itself?
> 
> Thanks for any help,
> Terry Jones
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by:
> Power Architecture Resource Center: Free content, downloads, 
> discussions, and more. http://solutions.newsforge.com/ibmarch.tmpl
> _______________________________________________
> PyMOL-users mailing list
> PyMOL-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pymol-users
> 
> 
> 
> 

Reply via email to