954,541 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How to handle an aborted C function called from Python

Just started working on a project that is using Python to drive C API's. When the C API's take an unhandled event they terminate using a C exit(3).

How can I monitor for these exit conditions with in my Python code and handle and process the error code used in the C functions exit?

I have searched around and tried many of the exception classes to no avail.

RDCooter
Newbie Poster
1 post since Jun 2009
Reputation Points: 10
Solved Threads: 0
 
slate
Posting Whiz in Training
252 posts since Jun 2008
Reputation Points: 72
Solved Threads: 66
 

If possible, set it up so you can call/execute the C functions using subprocess. See "Reading from the output of a pipe:" here http://www.doughellmann.com/PyMOTW/subprocess/index.html#module-subprocess

woooee
Nearly a Posting Maven
2,454 posts since Dec 2006
Reputation Points: 777
Solved Threads: 714
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You