Question: Cmdexception Exception In Tk Callback Name_Of_Types Pymol
0
gravatar for dave
7.1 years ago by
dave0
dave0 wrote:

CmdException Exception in Tk callback Function: <function callit="" at="" 0xc060844=""> (type: <type 'function'="">) Args: () Traceback (innermost last): File "/usr/lib/python2.7/dist-packages/Pmw/Pmw_1_3/lib/PmwBase.py", line 1747, in __call__ return apply(self.func, args) File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 498, in callit func(*args) File "/usr/lib/python2.7/dist-packages/pmg_tk/skins/normal/__init__.py", line 563, in update_volume if len(self.cmd.get_names_of_type("object:volume",public=1))>0: File "/usr/lib/python2.7/dist-packages/pymol/querying.py", line 1437, in get_names_of_type types = map(_self.get_type,obj) File "/usr/lib/python2.7/dist-packages/pymol/querying.py", line 1204, in get_type if _raising(r,_self): raise pymol.CmdException CmdException: <pymol.cmdexception instance="" at="" 0xb97f36c="">

I recently occasionally encounter this error when deleting and naming objects on Linux. Looks like get names_of_type is not safe

           if event.inaxes is ax:      
            x = event.xdata
            y = event.ydata
            x = round(x,0)
            y = round(y,0)
            x = int(x)
            y = int(y)
            coord = (x,y)


            for i in range(0,len(number_list)):

                if (coord == number_list[i]):
                if (delete == True):
                    pymol.cmd.do("delete CurrentCont")
                    delete =False
                pymol.cmd.do("distance CurrentCont, chain"+lc+" and resi "+resi1[i]+" and name CA, chain"+lc+" and resi "+resi2[i]+" and name CA")
                    global delete
                    delete = True

            for i in range(0,len(rres)):
            if (coord == mappingpredcont[i]):
               if (delete == True):
                       pymol.cmd.do("delete CurrentCont")
                       delete =False
               pymol.cmd.do("distance CurrentCont, chain"+lc+" and resi "+predresi1[i]+" and name CA, chain"+lc+" and resi "+predresi2[i]+" and name CA")
                   global delete
                   delete = True
python pymol • 2.6k views
ADD COMMENTlink modified 7.1 years ago by Istvan Albert ♦♦ 84k • written 7.1 years ago by dave0
0
gravatar for Istvan Albert
7.1 years ago by
Istvan Albert ♦♦ 84k
University Park, USA
Istvan Albert ♦♦ 84k wrote:

You have some odd constructs there. Why are you declaring the variable delete to be global after using it?

if (delete == True):
    pymol.cmd.do("delete CurrentCont")
    delete =False
    pymol.cmd.do("distance CurrentCont, chain"+lc+" and resi "+resi1[i]+" and name CA, chain"+lc+" and resi "+resi2[i]+" and name CA")
    global delete
    delete = True

The python spec also states that

Names listed in a global statement must not be used in the same code block textually preceding that global statement.

http://docs.python.org/release/2.4/ref/global.html

ADD COMMENTlink modified 7.1 years ago • written 7.1 years ago by Istvan Albert ♦♦ 84k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1970 users visited in the last hour