Hmm -- the code you posted seems to work just fine with the "run" command when saved as a text file, so my next guess is that perhap you're saving the script as something other than text? (RTF perhaps?)
HINT: If using TextEdit, select "Make Plain Text" from the Format menu.
DeLano Scientific LLC
Subscriber Support Services

From: pymol-users-bounces@lists.sourceforge.net [mailto:pymol-users-bounces@lists.sourceforge.net] On Behalf Of Sadler, Evan
Sent: Friday, February 29, 2008 7:17 AM
To: gilleain torrance; pymol-users
Subject: Re: [PyMOL] Scripts on Mac

That sounds reasonable to me but I know next to nothing about python.
Maybe I should have included the misbehaving script, which was taken directly from the PyMOL wiki script library:

## This is just a quick hack. For something more meaty see;
## http://arcib.dowling.edu/sbevsl/
## Version 0.0.00-000/1
## Turn off the virtual_trackball
cmd.set("virtual_trackball", "off")
## spacefill
def spacefill(p1=''):
cmd.extend("spacefill", spacefill)
## cartoon
def cartoon(p1=''):
cmd.extend("cartoon", cartoon)
## wireframe
def wireframe(p1=''):
cmd.extend("wireframe", wireframe)
## exit
def exit():
cmd.extend("exit", exit)

Any part of it works fine when pasted, but no part works when invoked by “run...”


On 2/28/08 10:02 PM, "gilleain torrance" <gilleain.torrance@gmail.com> wrote:

Hmm. Running scripts has always worked for me on a mac.

Could it be a tab/space problem, or just a character missing at the
end from a copy/paste?

gilleain torrance

On Thu, Feb 28, 2008 at 2:50 PM, Sadler, Evan <ESADLER@dom.wustl.edu> wrote:
> I can run scripts by pasting them, but they fail when I try to read them
>  from a file, as in:
>  PyMOL> run ~/scriptfolder/rasmolify.py
>  This generates lots of errors:
>  Traceback (most recent call last):
>   File "/Applications/MacPyMOL.app/pymol/modules/pymol/parser.py", line 333,
>  in parse
>  parsing.run_file(exp_path(layer.args[0]),self.pymol_names,self.pymol_names)
>   File "/Applications/MacPyMOL.app/pymol/modules/pymol/parsing.py", line
>  456, in run_file
>     execfile(file,global_ns,local_ns)
>   File "/Users/evansadler/pymolscripts/rasmolify.py", line 3
>      ^
>   SyntaxError: invalid syntax
>  Some result for MacPyMOL and X11 hybrid
>  What am I doing wrong?
>  Evan
>  --
>  J. Evan Sadler, M.D., Ph.D.
>  Howard Hughes Medical Institute
>  Washington University
>  660 S. Euclid Ave., Box 8022
>  St. Louis, MO   63110
>  Tel: 314-362-9067
>  FAX: 314-454-3012
>  email: esadler@wustl.edu
>  -------------------------------------------------------------------------
>  This SF.net email is sponsored by: Microsoft
>  Defy all challenges. Microsoft(R) Visual Studio 2008.
>  http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>  _______________________________________________
>  PyMOL-users mailing list
>  PyMOL-users@lists.sourceforge.net
>  https://lists.sourceforge.net/lists/listinfo/pymol-users

This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
PyMOL-users mailing list