`exec`-based routine crashes app upon migration from 3.4.3 to python 3.5.2.

Enjoys Math enjoysmath at gmail.com
Thu Jul 28 11:47:21 EDT 2016


I've manually set breakpoints and traced this app crash back to this
function:

    def loadLSobjsOfType(self, objType, listJ):
        if listJ != None:
            for objJ in listJ:
                _locals = locals()
                exec('obj = ' + objType + '(self)', None, _locals)
                obj = _locals['obj']
                obj.loadJson(objJ)
                self.addLSobjOfType(objType, obj)

when breakpoints are set on `obj=_locals['obj']` my wingware debugger kicks
in and throws a KeyError exeption.

So what's the proper way to get the return value of an exec call when there
is one?

Thanks.

Regards,
EM



More information about the Python-list mailing list