Thanks Phillip,<br><br>One silly question. Would it be possible to put a flag inside Trellis components that would allow to turn on some kind of debugging where if errors are thrown in rules they are made visible?<br>I was thinking about something like an optional debug decorator that gets thrown automatically around every rule if the debug flag is turned ON. <br>
<br>Thank you again for your quick answer. <br>Peter.<br><br><div class="gmail_quote">On Sat, Mar 22, 2008 at 6:48 PM, Phillip J. Eby &lt;<a href="mailto:pje@telecommunity.com">pje@telecommunity.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">At 06:19 PM 3/22/2008 +0200, Peter Damoc wrote:<br>
&gt;I&#39;ve started getting this error:<br>
&gt;<br>
&gt;AttributeError: Constants can&#39;t be changed<br>
&gt;The problem is that I don&#39;t know what I&#39;m doing wrong.<br>
&gt;I used Trellis to manage some computations based on an external<br>
&gt;object that contains a dictionary.<br>
&gt;In a resync method I&#39;m pushing the information inside a Trellis Dict object.<br>
&gt;Everything worked fine till today when for some cases I get the above error.<br>
&gt;<br>
&gt;How can I get more information about what my code is trying do to illegally?<br>
&gt;How can I get the name of the constant that its trying to change?<br>
<br>
</div>Okay, here&#39;s what&#39;s happening. &nbsp;You&#39;re actually getting a different<br>
error in your application; this is just masking it, because it&#39;s an<br>
error that happens during the rollback caused by the first<br>
error. &nbsp;The specific issue is that an undo operation is adding a<br>
listener back to a cell that&#39;s become Constant, because it had no<br>
listeners. &nbsp;(What&#39;s weird about that is that the setting of the cell<br>
to Constant should have been undone before it got back to this point<br>
in the rollback. &nbsp;So something else weird is going on.)<br>
<div class="Ih2E3d"><br>
<br>
&gt;here is a more complete trace:<br>
&gt;<br>
&gt;File &quot;c:\Projects\BPM\patient_display.py&quot;, line 133, in OnBiodynamic<br>
&gt; &nbsp; &nbsp; dlg.panel.mp.resync(dlg.panel.meas)<br>
&gt; &nbsp; File &quot;&lt;peak.events.trellis.wrap wrapping<br>
&gt; modules.biodynamic.measurements.resync at 0x01CC97F0&gt;&quot;, line 5, in resync<br>
&gt; &nbsp; File<br>
&gt; &quot;c:\python25\lib\site-packages\Trellis-0.6a1-py2.5.egg\peak\events\stm.py&quot;,<br>
&gt; line 466, in atomically<br>
&gt; &nbsp; &nbsp; return super(Controller,self).atomically(self._process, func, args, kw)<br>
&gt; &nbsp; File<br>
&gt; &quot;c:\python25\lib\site-packages\Trellis-0.6a1-py2.5.egg\peak\events\stm.py&quot;,<br>
&gt; line 186, in atomically<br>
&gt; &nbsp; &nbsp; self.cleanup(*sys.exc_info())<br>
&gt; &nbsp; File<br>
&gt; &quot;c:\python25\lib\site-packages\Trellis-0.6a1-py2.5.egg\peak\events\stm.py&quot;,<br>
&gt; line 309, in cleanup<br>
&gt; &nbsp; &nbsp; return super(Controller, self).cleanup(*args)<br>
<br>
</div>If you use pdb.pm() to get into this traceback, and walk up to this<br>
stack frame, you should be able to look at &#39;args&#39; to find out what<br>
the original exception was that started the problem. &nbsp;There really<br>
should be a better way to handle this, though.<br>
<br>
A possible workaround for the Constant part of the problem would be<br>
to ensure that any rule() in your application also has a value();<br>
that will ensure that the cell can never become constant (because<br>
it&#39;s writable). &nbsp;But I wouldn&#39;t try that unless the above doesn&#39;t<br>
resolve your issue.<br>
<br>
(It&#39;s too bad there&#39;s no way to link multiple exceptions together in<br>
Python right now, it&#39;d sure come in handy here. &nbsp;That way, you could<br>
see the first exception as well as the cleanup exception.)<br>
<br>
</blockquote></div><br><br clear="all"><br>-- <br>There is NO FATE, we are the creators.