I've started getting this error:<br clear="all"><pre class="literal-block">AttributeError: Constants can't be changed</pre>The problem is that I don't know what I'm doing wrong. <br>I used Trellis to manage some computations based on an external object that contains a dictionary.<br>
In a resync method I'm pushing the information inside a Trellis Dict object.<br>Everything worked fine till today when for some cases I get the above error.<br><br>How can I get more information about what my code is trying do to illegally? <br>
How can I get the name of the constant that its trying to change? <br><br>I must admit that the Trellis object where the offending method resides is a GOD object (large and tries to do way to much).<br><br>Thank you in advance.<br>
Peter<br><br><br>here is a more complete trace:<br><br>File "c:\Projects\BPM\patient_display.py", line 133, in OnBiodynamic<br> dlg.panel.mp.resync(dlg.panel.meas)<br> File "<peak.events.trellis.wrap wrapping modules.biodynamic.measurements.resync at 0x01CC97F0>", line 5, in resync<br>
File "c:\python25\lib\site-packages\Trellis-0.6a1-py2.5.egg\peak\events\stm.py", line 466, in atomically<br> return super(Controller,self).atomically(self._process, func, args, kw)<br> File "c:\python25\lib\site-packages\Trellis-0.6a1-py2.5.egg\peak\events\stm.py", line 186, in atomically<br>
self.cleanup(*sys.exc_info())<br> File "c:\python25\lib\site-packages\Trellis-0.6a1-py2.5.egg\peak\events\stm.py", line 309, in cleanup<br> return super(Controller, self).cleanup(*args)<br> File "c:\python25\lib\site-packages\Trellis-0.6a1-py2.5.egg\peak\events\stm.py", line 219, in cleanup<br>
self.rollback_to(0)<br> File "c:\python25\lib\site-packages\Trellis-0.6a1-py2.5.egg\peak\events\stm.py", line 259, in rollback_to<br> f(*a)<br> File "c:\python25\lib\site-packages\Trellis-0.6a1-py2.5.egg\peak\events\stm.py", line 141, in __new__<br>
subject.next_listener = self<br> File "C:\Python25\lib\site-packages\trellis-0.6a1-py2.5.egg\peak\events\trellis.py", line 226, in __setattr__<br> raise AttributeError("Constants can't be changed")<br>
AttributeError: Constants can't be changed<br><br><br>and the offending code:<br><br> @peak.events.trellis.modifier <br> def resync(self, m):<br> m.parent = self<br> # print list<br> for attr in self.m.keys():<br>
print type(m._vals[attr])<br> if attr in ["fullness", "shape", "subshape", "primary", "pocket_placement", "incision_approach","iw_adj", "ih_adj", "ip_adj"]:<br>
self.m[attr] = m._vals[attr]<br> elif m._vals[attr]:<br> self.m[attr] = m._vals[attr]<br> else:<br> self.m[attr] = m.defaults[attr]<br><br><br><br>-- <br>
There is NO FATE, we are the creators.