PyArg_ParseTuple exception catching

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • x0rster@gmail.com

    #1

    PyArg_ParseTuple exception catching

    Hi,

    I'm getting an error when using PyArg_ParseTupl e and I don't know
    why...In the documentation I've read that PyArg_ParseTupl e raise an
    appropriate exception :
    "on failure, it returns false and raises the appropriate exception."

    How can I get the exception in C ? because I've checked the arguments
    before calling the C python function and I don't know why I've got a
    problem when parsing the arguments list...

    Happy new year,
    PICA Frédéric

  • Fredrik Lundh

    #2
    Re: PyArg_ParseTupl e exception catching

    x0rster@gmail.c om wrote:
    [color=blue]
    > I'm getting an error when using PyArg_ParseTupl e and I don't know
    > why...In the documentation I've read that PyArg_ParseTupl e raise an
    > appropriate exception :
    > "on failure, it returns false and raises the appropriate exception."
    >
    > How can I get the exception in C ? because I've checked the arguments
    > before calling the C python function and I don't know why I've got a
    > problem when parsing the arguments list...[/color]

    the easiest way to see the exception is to return NULL, and let Python
    take care of the rest.

    if (!PyArg_ParseTu ple(...)):
    return NULL;

    </F>



    Comment

    Working...