[PEAK] help with more info

Peter Damoc pdamoc at gmail.com
Sat Mar 22 12:19:33 EDT 2008


I've started getting this error:

AttributeError: Constants can't be changed

The problem is that I don't know what I'm doing wrong.
I used Trellis to manage some computations based on an external object that
contains a dictionary.
In a resync method I'm pushing the information inside a Trellis Dict object.
Everything worked fine till today when for some cases I get the above error.

How can I get more information about what my code is trying do to illegally?

How can I get the name of the constant that its trying to change?

I must admit that the Trellis object where the offending method resides is a
GOD object (large and tries to do way to much).

Thank you in advance.
Peter


here is a more complete trace:

File "c:\Projects\BPM\patient_display.py", line 133, in OnBiodynamic
    dlg.panel.mp.resync(dlg.panel.meas)
  File "<peak.events.trellis.wrap wrapping
modules.biodynamic.measurements.resync at 0x01CC97F0>", line 5, in resync
  File "c:\python25\lib\site-packages\Trellis-
0.6a1-py2.5.egg\peak\events\stm.py", line 466, in atomically
    return super(Controller,self).atomically(self._process, func, args, kw)
  File "c:\python25\lib\site-packages\Trellis-
0.6a1-py2.5.egg\peak\events\stm.py", line 186, in atomically
    self.cleanup(*sys.exc_info())
  File "c:\python25\lib\site-packages\Trellis-
0.6a1-py2.5.egg\peak\events\stm.py", line 309, in cleanup
    return super(Controller, self).cleanup(*args)
  File "c:\python25\lib\site-packages\Trellis-
0.6a1-py2.5.egg\peak\events\stm.py", line 219, in cleanup
    self.rollback_to(0)
  File "c:\python25\lib\site-packages\Trellis-
0.6a1-py2.5.egg\peak\events\stm.py", line 259, in rollback_to
    f(*a)
  File "c:\python25\lib\site-packages\Trellis-
0.6a1-py2.5.egg\peak\events\stm.py", line 141, in __new__
    subject.next_listener = self
  File "C:\Python25\lib\site-packages\trellis-
0.6a1-py2.5.egg\peak\events\trellis.py", line 226, in __setattr__
    raise AttributeError("Constants can't be changed")
AttributeError: Constants can't be changed


and the offending code:

    @peak.events.trellis.modifier
    def resync(self, m):
        m.parent = self
        # print list
        for attr in self.m.keys():
            print type(m._vals[attr])
            if attr in ["fullness", "shape", "subshape", "primary",
"pocket_placement", "incision_approach","iw_adj", "ih_adj", "ip_adj"]:
                self.m[attr] = m._vals[attr]
            elif m._vals[attr]:
                self.m[attr] = m._vals[attr]
            else:
                self.m[attr] = m.defaults[attr]



-- 
There is NO FATE, we are the creators.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.eby-sarna.com/pipermail/peak/attachments/20080322/e06e9048/attachment.html


More information about the PEAK mailing list