M
mmacrobert
Hi Everyone,
I've created a 'C' dll that is accessed via ctypes library containing
a bunch of functions. I've successfully been able to use the
functions. However, I would like to throw python exceptions from some
of them.
I throw them using: :yErr_SetStringyExc_RuntimeError,
theErrorString);
I crash the console when this function is invoked in the 'C' domain. I
get an error stating:
Fatal Python error: PyThreadState_Get: no current thread
when the calling code in python is:
try:
cdll.MyDll.ThrowingFunction()
except:
print "An error has occurred"
The dll is just a plain win32 'C' dll, built with an MS compiler. How
do I throw python exceptions correctly? Is there some kind of "init"
function that needs to be called?
Any help much appreciated.
Thanks,
Martin
I've created a 'C' dll that is accessed via ctypes library containing
a bunch of functions. I've successfully been able to use the
functions. However, I would like to throw python exceptions from some
of them.
I throw them using: :yErr_SetStringyExc_RuntimeError,
theErrorString);
I crash the console when this function is invoked in the 'C' domain. I
get an error stating:
Fatal Python error: PyThreadState_Get: no current thread
when the calling code in python is:
try:
cdll.MyDll.ThrowingFunction()
except:
print "An error has occurred"
The dll is just a plain win32 'C' dll, built with an MS compiler. How
do I throw python exceptions correctly? Is there some kind of "init"
function that needs to be called?
Any help much appreciated.
Thanks,
Martin