Re: [gamin] can a Python callback, exit?



On Thu, Mar 08, 2007 at 05:14:44PM -0800, Don Lindsay wrote:
> 
> More specifically, can a Python "try-except" clause catch an exception 
> raised inside a callback?

  in general no. The C code won't forward the exception (assuming I
understood the question properly).

> I tried it - admittedly with gamin-0.1.7-8.fc6, not with 1.8. The 
> exception wasn't politely caught.
> 
> I also notice that none of the test programs do "raise" or "exit()" inside 
> callbacks, and flood.py returns status to the mainline by setting a global 
> variable "ok". What I want to do, is to terminate the watching program if 
> the thing being watched gets deleted. Do I have to code it like flood.py ?

 I don't remember precisely but I guess sys.exit() would exit the program
unless there is some kind of threading involved. For exceptions propagations
I'm pretty sure it doesn't work though ...

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]