Problems with exceptions

woc8r@opal.cs.virginia.edu
Fri, 18 Feb 94 15:49:23 EST

I'm writing a program that extending Python with C code. From the C
code I'm calling Python functions, but if an exception occurs in the
Python function, nothing happens (it just stops running and goes back
to the C module). Does anybody have any ideas what might be causing
this?

The interesting thing is that I'm calling a Python callback from a
Python function that was called from C using an exception handler, and
nothing is raised, even if there is an error.

The code I have...
in buton.py:
def callbackFunction (suitObject):
print 'The user pressed the button.'
luago ## This should cause a NameError exception to be raised

in suit.py:
def PythonGenericCallback (realCallback, param):
try:
realCallback(param)
except:
suit.inform ('An error occurred during execution of your callback function; perhaps you have a name error or syntax error?')

where realCallback is the callbackFunction object and param is the
suitObject object. When the whole program is run, no exception seems
to be raised (although an exception is raised if callbackFunction is
called directly from the main Python process).

Thanks!
___ ___
\ \ / / -=Bill Carlson=- | "I wanna decide who
\ \/ / | lives and who dies"
\ / INTERNET: woc8r@Virginia.EDU |
\__/ BITNET: woc8r@VIRGINIA | -Crow T. Robot