<div class="gmail_quote">Team,<br>
<br></div><div class="gmail_quote">Wish to have your feedback on the
design aspect of the ticket 2063 (Sugar should bring up an alert when an
unhandled Python exception occurs) - please find the git diff attached
below. This is an attempt to display an alert when an unhandled Python
exception occurs in the journal. Unfortunately, when the exception takes
place in journalactivity.py , I am neither unable to notice the Journal
Icon (it disappears), </div><div class="im">
<div class="gmail_quote"><br>
<br>
diff --git a/journalactivity.py b/journalactivity.py<br>
index 44cc018..36a2e2e 100644<br>
--- a/journalactivity.py<br>
+++ b/journalactivity.py<br>
@@ -358,8 +358,20 @@ class JournalActivity(Window):<br>
self.show_main_view()<br>
self.search_grab_focus()<br>
<br>
+ def uncaught_exception_alert(self):<br>
+ alert = ErrorAlert(title="Operation could not be performed", msg="Please check the logviewer activity for details ")<br>
+ alert.connect('response', self.__alert_response_cb)<br>
+ self.add_alert(alert)<br>
+ alert.show()<br>
+<br>
_journal = None<br>
<br>
+def _alert_excepthook(exc_type, exc_value, traceback):<br>
+ logging.exception('Unhandled Python exception: %s', repr((exc_type, exc_value, traceback)))<br>
+ _journal.uncaught_exception_alert() <br>
+<br>
+sys.excepthook = _alert_excepthook<br>
+<br>
def get_journal():<br>
global _journal<br>
if _journal is None:<br>
-- <br>
1.7.0.4</div><div class="gmail_quote"><br></div></div><div class="gmail_quote"><br>
I wish to request you to please review the code and suggest desired changes, if any.<br>
<br>
Moreover, I have two important questions regarding the bug.<br>
<br>
1. To catch all unhandled python exceptions in sugar, where exactly
should we be looking forward to be the venue for adding the
functionality?<div class="im"><br>
Adding it in journalactivity.py doesn't seem to serve all purposes.
It has to be added somewhere which is being used all the time.<br>
<br></div>
2. Wish if you could recommend on the GUI feature that could be used for displaying the alert message to the user.<br>
<br>Looking forward to for your valuable suggestions,<div class="im"><br>
<br>
Regards,<br><font color="#888888">
<br>
Mukul Gupta<br>
Research Engineer,SEETA
</font></div></div><br><br><div class="gmail_quote">On Tue, Oct 12, 2010 at 12:46 AM, Mukul Gupta <span dir="ltr"><<a href="mailto:mukul@seeta.in">mukul@seeta.in</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div><div><div class="gmail_quote">Team,<br><br></div><div class="gmail_quote">I
had a discussion with Aleksey this morning at IRC on the feedback
recommended yesterday. Thank you Daniel and Tomeu. Appreciate your ideas
and pointers. </div>
<div class="gmail_quote"><br></div><div class="gmail_quote">We
brainstormed on how the implementation of this functionality could be
done, and found that whenever any uncaught exception is raised, the
interpreter calls the sys.excepthook(type,value,traceback). </div>
<div class="gmail_quote"><br></div><div class="gmail_quote">Wish to have
the feedback on whether excepthook implementation would be helpful to
our use-case both short-term and long-term. Also, it would be wonderful
if feedback could be shared on its implementation in the context of
Sugar, or otherwise.</div>
<br>Looking forward to hearing from you.<br><br>Regards,<br><font color="#888888"><font color="#888888"><font color="#888888"><br>Mukul Gupta</font>
</font></font></div></div><div><div></div><div class="h5"><br><br><div class="gmail_quote">On Mon, Oct 11, 2010 at 2:14 PM, Manusheel Gupta <span dir="ltr"><<a href="mailto:manu@seeta.in" target="_blank">manu@seeta.in</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Tomeu and Daniel,<div><br></div><div><br></div><div><div class="gmail_quote"><div>On Mon, Oct 11, 2010 at 1:50 PM, Tomeu Vizoso <span dir="ltr"><<a href="mailto:tomeu@sugarlabs.org" target="_blank">tomeu@sugarlabs.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div><div></div><div>On Mon, Oct 11, 2010 at 09:57, Daniel Drake <<a href="mailto:dsd@laptop.org" target="_blank">dsd@laptop.org</a>> wrote:<br>
> On 10 October 2010 20:14, Mukul Gupta <<a href="mailto:mukul@seeta.in" target="_blank">mukul@seeta.in</a>> wrote:<br>
>> With reference to SL Bug # 2063 which deals with bringing some kind of<br>
>> notification alert whenever an unhandled python exception occurs, I had a<br>
>> few doubts. There are two approaches that I can think of.<br>
><br>
> Neither of these sounds sensible.<br>
><br>
> What's wrong with the obvious solution of popping up a dialog when the<br>
> exception occurs?<br>
><br>
> Technically the exceptions are not unhandled, if they were unhandled<br>
> then sugar would crash. I guess we're referring to exceptions that are<br>
> not handled gracefully and instead fall back to a catch-all handler<br>
> which does not have the knowledge to act on them.<br>
<br>
</div></div>This is what abrt does with python (and other) processes, maybe we<br>
could reuse it or at least steal some of the ideas:<br>
<br>
<a href="https://fedorahosted.org/abrt/" target="_blank">https://fedorahosted.org/abrt/</a></blockquote><div><br></div><div><br></div></div><div><div>Thank you for the feedback and pointers. Appreciate it.</div><div><br>
</div>
<div>We'll discuss the approach shared by you this afternoon.</div><div><br></div><div>Regards,</div><div><br></div><div>Manu</div></div><div><br></div><div><br></div><div><br></div></div><br></div>
</blockquote></div><br>
</div></div></blockquote></div><br>