> | NameError: name 'a' is not defined > > I guess I understand what's going on here. I'm happier just > calling the command line run or execfile() myself.
Terry, PyMOL command parsing takes precedence over Python, so a = 1 Is interpreted as a call to the command "a" with arguments "=" and "1". Lines starting with Python keywoards (if, for, while, etc.) are automatically handed over to Python, but you can force Python evaluation with a leading forward slash /a = 1 Or you can just make sure that the first non-whitespace-containing string cannot be interpreted as a PyMOL command. For example: a= 1 will work since "a=" cannot be confused with a PyMOL command. Cheers, Warren -- 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: Terry Jones [mailto:tc...@hermes.cam.ac.uk] On Behalf > Of Terry Jones > Sent: Monday, October 03, 2005 10:59 AM > To: Warren DeLano > Cc: pymol-users@lists.sourceforge.net > Subject: RE: [PyMOL] Using the Pymol Run command > > Hi Warren and Gilleain - thanks for your rapid answers. For > now I am simply using 'run' on the command line and it works fine. > > | Gilleain is right on about the run command. On Windows and > linux, you > | can also create .pym files that will specifically open into PyMOL. > > I don't understand this. > > | Another alternative is to use Python import capability. > > OK, thanks. > > | 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 > > I had tried this approach after seeing some trailing > backslash processing in the source, but I couldn't make it > work. For example, loading (via > File/Run) a file that contains just this: > > a = 4 > b = 4 > if a == b: \ > print 'equal' > > gets me an error: > > | PyMOL>a = 4 > | Error: ambiguous command: > | abort alias alter angle assert > | accept align alter_state as attach > | PyMOL>b = 4 > | Error: ambiguous command: > | backward bg_color bond break button > | PyMOL>if a == b: \ > | PyMOL>print 'equal' > | Traceback (most recent call last): > | File > "/users/warren/pymol/products/MacPyMOL.app/pymol/modules/pymol > /parser.py", line 194, in parse > | exec(com2[nest]+"\n",pymol_names,pymol_names) > | File "<string>", line 1, in ? > | NameError: name 'a' is not defined > > I guess I understand what's going on here. I'm happier just > calling the command line run or execfile() myself. > > Thanks again for the quick help. > > Regards, > Terry. > > > >