5 messages in com.googlegroups.pylons-discussRe: Publishing application with avahi
FromSent OnAttachments
Chris AtLee28 Jan 2008 13:23 
Cliff Wells28 Jan 2008 17:01 
Philip Jenvey28 Jan 2008 23:15 
Chris AtLee29 Jan 2008 06:09 
Chris AtLee29 Jan 2008 07:10 
Subject:Re: Publishing application with avahi
From:Chris AtLee (chri@public.gmane.org)
Date:01/29/2008 06:09:26 AM
List:com.googlegroups.pylons-discuss

On Jan 29, 2008 2:15 AM, Philip Jenvey
<pjen@public.gmane.org> wrote:

Is there a way to get notified when your application is about to be shut down? Paste looks like it just sends SIGTERM to the process when it detects a modified file, but maybe I'm missing something.

If Cliff's suggestion doesn't work -- in general, the way to get a callback when python quits is via the atexit module.

I've tried to register a function via atexit, but it's not being called. This is probably because, according to the atexit docs, "Note: the functions registered via this module are not called when the program is killed by a signal, when a Python fatal internal error is detected, or when os._exit() is called."

I'll give Cliff's suggestion a try and see how that goes. The avahi bindings for python are pretty barebones, I was hoping not to have to get into that :)

Cheers, Chris