quitting the mainloop.

Heston James heston_james at live.co.uk
Thu May 7 07:08:18 PDT 2009


> Heston James schrieb:
>>
>> I would expect that 'if' block to be processed at all after the 
>> mainloop has been killed. Am I doing something wrong? Need I do more 
>> to ensure the application exits properly?
>>
>> Thanks for your advice everyone, I appreciate it.
> Hi Heston,
> 
> i'm not a Python programmer... but IMHO quitting the main loop doesn't 
> mean quitting the whole application - it just quitts the thread running 
> the main loop in the background. That's why your if statement is reached 
> in any case.
> 
> Regards,
> Till

Hi Till,
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.
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.
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:
ERROR:dbus.connection:Exception in handler for D-Bus signal:Traceback (most recent call last):  File "/var/lib/python-support/python2.5/dbus/connection.py", line 214, in maybe_handle_message    self._handler(*args, **kwargs)  File "/myapp/src/model/adapter/adapter.py", line 140, in __remote_device_found_cb    self.remote_device_found(address, values["RSSI"])  File "/myapp/src/myapp.py", line 259, in remote_device_found    sys.exit(2)SystemExit: 2
Hopefully someone with some python experience can help me out with this.
Thanks again Till,
Heston
_________________________________________________________________
View your Twitter and Flickr updates from one place – Learn more!
http://clk.atdmt.com/UKM/go/137984870/direct/01/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/dbus/attachments/20090507/e0de6d5d/attachment.htm 


More information about the dbus mailing list