On Wed, Apr 24, 2019 at 3:18 AM Vincent Vande Vyvre <vincent.vande.vy...@telenet.be> wrote: > > Hi, > > In a CPython lib I have an _init() method wich take one argument, a file > name. > > char *fname; > > if (!PyArg_ParseTuple(args, "s", &fname)) > return NULL; > > So, if I instanciate my object with a bad argument I've a good error > message: > > tif = ImgProc(123) > TypeError: argument 1 must be str, not int > (followed by the traceback) > > But if I do: > try: > tif = ImgProc(123) > except Exception as why: > print("Error:", why) > > I get just: > > Error: <class '_liboqapy.ImgProc'> returned a result with an error set >
It looks like there's an internal problem in the C function. Are you sure it's hitting the PyArg_ParseTuple and then immediately returning NULL? Post a bit more of your code; this error looks like something is leaving an error state but then carrying on with the code. ChrisA -- https://mail.python.org/mailman/listinfo/python-list