C built and raised exceptions are not being catched in Python code

Vinko Vrsalovic vinko at cprsig.cl
Wed Feb 26 02:51:42 EST 2003


Hello,

	I'm rather new to Python (and to this list/newsgroup also) and 
	I'm embedding it in a C++ application. I managed to wrap basic 
	structures, datatypes, build modules, etc., but I'm having a little 
	problem with exceptions.

	I built a new exception class in C code as part of a C-built module. 
	The following is the behavior I'm getting:

	- If I raise the C-built exception in Python code, I can catch it in
	  Python or C code.
	- If I raise it in C code, I can only catch it in C code, the
	  except clause in Python code acts as if no exception was
	  raised.

	Of course, I'd like to catch C raised exceptions in Python
	code also, but I don't see what might be failing.

	Is it possible to catch in Python the C raised exceptions?

	If yes, what might be the cause of this problem? Any classical
	pitfalls on this issue?
	  
	What info is needed to tell what I'm doing wrong? 

	I'm using MSVC++.Net, Python 2.2.2, under Windows.

Thank you very much,
-- 
Vinko Vrsalovic <el[|- at -|]vinko.cl>
http://www.cprsig.cl





More information about the Python-list mailing list