Cmdexception Exception In Tk Callback Name_Of_Types Pymol
1
0
Entering edit mode
11.0 years ago
dave • 0

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
pymol python • 3.8k views
ADD COMMENT
0
Entering edit mode
11.0 years ago

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 COMMENT

Login before adding your answer.

Traffic: 2102 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6