tracebacks in embedded python

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mike Müller

    tracebacks in embedded python

    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
  • Thomas Heller

    #2
    Re: tracebacks in embedded python

    [email protected] e (Mike Müller) writes:
    [color=blue]
    > 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)?[/color]

    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

    Comment

    Working...