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 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 ?

 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 ...


Red Hat Virtualization group
Daniel Veillard      | virtualization library
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

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