Hi Richard,

* Richard Gillilan <r...@cornell.edu> [2007-02-19 10:22] wrote:
> 
> I'm probably making a simpler mistake here, or perhaps there is  
> something wrong with my installation or paths.
> I'm trying to load and display the simple cgo example in the manual.  
> I created a file named "arrows" containing this definition:
> 
> from pymol.cgo import *    # get constants
> from pymol import cmd
> 
> obj = [
>     BEGIN, LINES,
>     COLOR, 1.0, 1.0, 1.0,
> 
>     VERTEX, 0.0, 0.0, 0.0,
>     VERTEX, 1.0, 0.0, 0.0,
> 
>     VERTEX, 0.0, 0.0, 0.0,
>     VERTEX, 0.0, 2.0, 0.0,
> 
>     VERTEX, 0.0, 0.0, 0.0,
>     VERTEX, 00, 0.0, 3.0,
> 
>     END
>     ]
> 
>  From the Pymol prompt I then attempt to load it:
> 
> PyMOL> cmd.load_cgo(obj,'/Volumes/transport/AFABP_structs/Linoleic4/ 
> rf10_TLS/arrows');
> 
> I get the following error:
> 
> Traceback (most recent call last):
>    File "/Users/delwarl/MacPyMOL060228/build/Deployment/MacPyMOL.app/ 
> pymol/modules/pymol/parser.py", line 370, in parse
>    File "<string>", line 1, in ?
> NameError: name 'obj' is not defined
> 
> Anyone recognize what I am doing wrong here?

The cmd.load_cgo command wants the object and object name as parameters,
so you want to put the load_cgo command within your file and use the run
command to load it (it is a python file):

# ---------  arrows.py ---------------------------
from pymol.cgo import *    # get constants
from pymol import cmd

obj = [
    BEGIN, LINES,
    COLOR, 1.0, 1.0, 1.0,

    VERTEX, 0.0, 0.0, 0.0,
    VERTEX, 1.0, 0.0, 0.0,

    VERTEX, 0.0, 0.0, 0.0,
    VERTEX, 0.0, 2.0, 0.0,

    VERTEX, 0.0, 0.0, 0.0,
    VERTEX, 00, 0.0, 3.0,

    END
    ]

cmd.load_cgo(obj,'arrows')

Load it into PyMOL with:
PyMOL> run arrows.py

Cheers,
Rob
-- 
Robert L. Campbell, Ph.D.
Senior Research Associate/Adjunct Assistant Professor 
Botterell Hall Rm 644
Department of Biochemistry, Queen's University, 
Kingston, ON K7L 3N6  Canada
Tel: 613-533-6821            Fax: 613-533-2497
<robert.campb...@queensu.ca>         http://adelie.biochem.queensu.ca/~rlc

Reply via email to