<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
> Heston James schrieb:<br>>><br>>> I would expect that 'if' block to be processed at all after the <br>>> mainloop has been killed. Am I doing something wrong? Need I do more <br>>> to ensure the application exits properly?<br>>><br>>> Thanks for your advice everyone, I appreciate it.<br>> Hi Heston,<br>> <br>> i'm not a Python programmer... but IMHO quitting the main loop doesn't <br>> mean quitting the whole application - it just quitts the thread running <br>> the main loop in the background. That's why your if statement is reached <br>> in any case.<br>> <br>> Regards,<br>> Till<br><div><br></div><div>Hi Till,</div><div><br></div><div>Thank you for your reply! I think you are right, that would make sense, the mainloop is stopped but the app effectively continues running until an exception occurs.</div><div><br></div><div>I'm hoping someone will be able to help explain the best way for me to gracefully exit an application when an exception occurs in the handlers, i,e, database call fails.</div><div><br></div><div>I've modified my code to do a sys.exit() after it has stopped the mainloop, however this still causes an exception to be thrown on exit or the application:</div><div><br></div><div><div>ERROR:dbus.connection:Exception in handler for D-Bus signal:</div><div>Traceback (most recent call last):</div><div> File "/var/lib/python-support/python2.5/dbus/connection.py", line 214, in maybe_handle_message</div><div> self._handler(*args, **kwargs)</div><div> File "/myapp/src/model/adapter/adapter.py", line 140, in __remote_device_found_cb</div><div> self.remote_device_found(address, values["RSSI"])</div><div> File "/myapp/src/myapp.py", line 259, in remote_device_found</div><div> sys.exit(2)</div><div>SystemExit: 2</div><div><br></div></div><div>Hopefully someone with some python experience can help me out with this.</div><div><br></div><div>Thanks again Till,</div><div><br></div><div>Heston</div><br /><hr />Windows Live Messenger just got better. <a href='http://clk.atdmt.com/UKM/go/134665230/direct/01/' target='_new'>Find out more!</a></body>
</html>