Using EErrorCode from pyroot

I would like to call gInterpreter.ProcessLine on a custom header file in pyroot. When finding that file fails, I would like to catch the error and report it to the user. Reading the documentation, I think this means I need to use a TInterpreter::EErrorCode*, but I cannot work out how to do it. For example, I have tried:

err_ptr = ROOT.MakeNullPointer(ROOT.TInterpreter.EErrorCode)
ROOT.gInterpreter.ProcessLine(f'#include "/path/to/some/lib.h"', err_ptr)

But that doesn’t work:

  File "....", line 3, in <module>
    err_ptr = ROOT.MakeNullPointer(ROOT.TInterpreter.EErrorCode)
TypeError: BindObject expects a valid class or class name as an argument

So my question is: how to properly do the error handling for that ProcessLine function. Which I hope boils down to using EErrorCode correctly. Thank you so much in advance!


_ROOT Version: 6.22/06
_Platform: Centos 7
_Compiler:gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)


Hi,

Thanks for the question!
Is it an option to use ROOT.gInterpreter.Declare('#include "/path/to/some/lib.h"') ? In case of success, it returns true, false otherwise…

Cheers,
D

That worked for me as a workaround! Thank you so much for the fast reply and help!