Hello Warren,

When adding in the "cmd." I get these error messages:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: 'module' object has no attribute 'sym_partner'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: 'module' object has no attribute 'cell_shift_helper'

Versus the error I get with the "cmd." not included:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'sym_partner' is not defined
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'cell_shift_helper' is not defined

I'm pretty stumped at this point. Does it seem like the pymol.cmd namespace
isn't acquiring the new functions as it ought to be?


Stuart

2009/8/24 Warren DeLano <war...@delsci.com>

>  Hello Stuart,
>
>
>
> By default, alter_state expressions are evaluated in the “pymol” namespace
> of the current PyMOL instance, not the “cmd” (pymol.cmd) namespace.  The
> reason why it works with ‘run’ is that run also executes in “pymol” by
> default, and thus, includes any functions you define.
>
>
>
> Try:
>
>
>
> cmd.alter_state(1, copy, "x,y,z = cmd.sym_partner([x,y,z], stored.tmpOp)")
>
>  instead, after using cmd.extend in your startup or GUI script.
>
>
>
> Cheers,
>
> Warren
>
>
>
>
>   ------------------------------
>
> *From:* Stuart Ballard [mailto:srball...@wisc.edu]
> *Sent:* Monday, August 24, 2009 3:38 PM
> *To:* pymol-users
> *Subject:* [PyMOL] Calling scripted functions within alter_state
>
>
>
> Hello Warren, all,
>
>
> I've been working on a plugin for PyMOLX11Hybrid, in which I have a few
> lines of code such as:
>
>         cmd.alter_state(1, copy, "x,y,z = sym_partner([x,y,z],
> stored.tmpOp)")
>
> AND
>
>     cmd.alter_state(1, object, "x,y,z =
> cell_shift_helper([x,y,z],stored.shift)")
>
> Both those functions (sym_partner and cell_shift_helper) are extended
> through cmd.extend() function, along with several others which work
> perfectly well. The issue arises only when I attempt to use these functions
> through a menu added to PyMOL GUI, which does not involve issuing the run
> /(filepath)/(script).py command in PyMOL, but rather initializes necessary
> commands on startup. I've confirmed that the cmd.extend() calls are made
> properly, but I can only fix the problem by issuing the run command
> independent of my initialization scripts.
>
> Because this script is planned to be incorporated into a build of PyMOL
> which will be run from a variety of file paths, I'd like to know how I can
> solve this problem without simply jury rigging a run command. Is there a way
> to properly make commands available within an alter_state command without
> using the run command?
>
>
> Thanks,
> Stuart Ballard
> Dept. of Biochemistry
> UW-Madison
>
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net

Reply via email to