# Using EErrorCode from pyroot

**URL:** <https://root-forum.cern.ch/t/using-eerrorcode-from-pyroot/61897>\
**Category:** Newbie\
**Tags:** python\
**Created:** [October 9, 2024, 9:07pm UTC](https://root-forum.cern.ch/t/using-eerrorcode-from-pyroot/61897 "2024-10-09T21:07:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![clark2668](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/clark2668/32/37769_2.png) [@clark2668](https://root-forum.cern.ch/u/clark2668)\
**Post date:** [October 9, 2024, 9:07pm UTC](https://root-forum.cern.ch/t/using-eerrorcode-from-pyroot/61897/1 "2024-10-09T21:07:19Z")

</div>

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:

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

```

But that doesn’t work:

```Traceback
  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)

* * *

---

<div class="post-metadata">

**Author:** ![Danilo](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/danilo/32/34528_2.png) [@Danilo](https://root-forum.cern.ch/u/Danilo)\
**Post date:** [October 10, 2024, 6:37am UTC](https://root-forum.cern.ch/t/using-eerrorcode-from-pyroot/61897/2 "2024-10-10T06:37:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![clark2668](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/clark2668/32/37769_2.png) [@clark2668](https://root-forum.cern.ch/u/clark2668)\
**Post date:** [October 10, 2024, 4:34pm UTC](https://root-forum.cern.ch/t/using-eerrorcode-from-pyroot/61897/3 "2024-10-10T16:34:07Z")

</div>

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