tracebacks in embedded python

  • Thread starter =?ISO-8859-1?Q?Mike_M=FCller?=
  • Start date
?

=?ISO-8859-1?Q?Mike_M=FCller?=

When I embed Python into C there is no traceback message on the screen
after an uncaught exception. Using sys.exc_info() I can print may own
traceback but I would need to insert try except statements at
different places. Is there a way to "turn on" traceback writing to
std.err (that also shows up at the screen)?

Thanks

Mike
 
T

Thomas Heller

When I embed Python into C there is no traceback message on the screen
after an uncaught exception. Using sys.exc_info() I can print may own
traceback but I would need to insert try except statements at
different places. Is there a way to "turn on" traceback writing to
std.err (that also shows up at the screen)?

You should check the return value of the Python API call for failure.
Most functions return NULL or -1 on error.
Then you call PyErr_Print().

Thomas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,077
Messages
2,570,566
Members
47,202
Latest member
misc.

Latest Threads

Top