# Getting an error while running my code

**URL:** <https://root-forum.cern.ch/t/getting-an-error-while-running-my-code/43545>\
**Category:** Newbie\
**Created:** [February 15, 2021, 10:46am UTC](https://root-forum.cern.ch/t/getting-an-error-while-running-my-code/43545 "2021-02-15T10:46:10Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![robertfroast](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/robertfroast/32/21121_2.png) [@robertfroast](https://root-forum.cern.ch/u/robertfroast)\
**Post date:** [February 15, 2021, 10:46am UTC](https://root-forum.cern.ch/t/getting-an-error-while-running-my-code/43545/1 "2021-02-15T10:46:10Z")

</div>

Hi  
Hope you are doing great.  
I am getting the following error while running my code.  
Please guide me.  
Have a nice day.

_ROOT Version:_ Not Provided  
_Platform:_ Not Provided  
_Compiler:_ Not Provided

* * *

---

<div class="post-metadata">

**Author:** ![robertfroast](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/robertfroast/32/21121_2.png) [@robertfroast](https://root-forum.cern.ch/u/robertfroast)\
**Post date:** [February 15, 2021, 10:53am UTC](https://root-forum.cern.ch/t/getting-an-error-while-running-my-code/43545/2 "2021-02-15T10:53:08Z")

</div>

Hi  
following are the files that I am having problem.

The error is:

```
root -l eff_1.C
root [0] 
Processing eff_1.C...
#0 0x00007ff3e96ce457 in __GI___ waitpid (pid=6744, stat_loc=stat_loc
entry=0x7ffdaa4d9fd8, options=options
entry=0) at ../sysdeps/unix/sysv/linux/waitpid.c:30
#1 0x00007ff3e9639177 in do_system (line=<optimized out>) at ../sysdeps/posix/system.c:149
#2 0x00007ff3ea2e2b23 in TUnixSystem::Exec (shellcmd=<optimized out>, this=0x55e3eee347c0) at /home/robert/Downloads/root6/core/unix/src/TUnixSystem.cxx:2119
#3 TUnixSystem::StackTrace (this=0x55e3eee347c0) at /home/robert/Downloads/root6/core/unix/src/TUnixSystem.cxx:2413
#4 0x00007ff3e4ada005 in cling::MultiplexInterpreterCallbacks::PrintStackTrace() () from /home/robert/Downloads/MyRoot/lib/libCling.so
#5 0x00007ff3e4ad9a0b in cling_runtime_internal_throwIfInvalidPointer () from /home/robert/Downloads/MyRoot/lib/libCling.so
#6 0x00007ff3eaa8418b in ?? ()
#7 0x0000000000000000 in ?? ()
Error in <HandleInterpreterException>: Trying to dereference null pointer or trying to call routine taking non-null arguments.
Execution of your code was aborted.
In file included from input_line_10:1: **/home/robert/Downloads/MyRoot/macros/CK/eff\_1.C:18:22:**  **warning:** **null passed to a callee that requires a non-null argument [-Wnonnull]**TH1F *h2 = (TH1F*)f->Get("h")->Clone();
```

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [February 15, 2021, 11:02am UTC](https://root-forum.cern.ch/t/getting-an-error-while-running-my-code/43545/3 "2021-02-15T11:02:05Z")

</div>

Looks like no histogram named “h” exists in your “f” file. Try: `f->ls();`

---

<div class="post-metadata">

**Author:** ![robertfroast](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/robertfroast/32/21121_2.png) [@robertfroast](https://root-forum.cern.ch/u/robertfroast)\
**Post date:** [February 15, 2021, 11:06am UTC](https://root-forum.cern.ch/t/getting-an-error-while-running-my-code/43545/4 "2021-02-15T11:06:54Z")

</div>

@Wile_E_Coyote  
Where should I have to write it in the code or in the terminal? ( `f->ls();`)

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [February 15, 2021, 11:10am UTC](https://root-forum.cern.ch/t/getting-an-error-while-running-my-code/43545/5 "2021-02-15T11:10:51Z")

</div>

You can also try the standalone tool: `rootls -l your_file.root`

---

<div class="post-metadata">

**Author:** ![robertfroast](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/robertfroast/32/21121_2.png) [@robertfroast](https://root-forum.cern.ch/u/robertfroast)\
**Post date:** [February 15, 2021, 11:16am UTC](https://root-forum.cern.ch/t/getting-an-error-while-running-my-code/43545/6 "2021-02-15T11:16:16Z")

</div>

@Wile_E_Coyote

I tried but following error is coming up  
rootls -l 16O+100Mo@102MeV-2f-1.001.root  
Traceback (most recent call last):  
File “/home/Downloads/MyRoot/bin/rootls”, line 10, in   
import cmdLineUtils  
ImportError: No module named cmdLineUtils

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [February 15, 2021, 11:20am UTC](https://root-forum.cern.ch/t/getting-an-error-while-running-my-code/43545/7 "2021-02-15T11:20:54Z")

</div>

It seems you do not have “pyroot”.  
Try:

```bash
root your_file.root -q -e 'gFile->ls();'

```

---

<div class="post-metadata">

**Author:** ![robertfroast](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/robertfroast/32/21121_2.png) [@robertfroast](https://root-forum.cern.ch/u/robertfroast)\
**Post date:** [February 15, 2021, 11:27am UTC](https://root-forum.cern.ch/t/getting-an-error-while-running-my-code/43545/8 "2021-02-15T11:27:26Z")

</div>

@Wile_E_Coyote

```
What Can I do to view the spectrums in these files?
I know that I can view the spectrums in TBrowser but for doing calibration my file [eff_1.C|attachment](https://root-forum.cern.ch/uploads/short-url/trhdcRigiNPJhFu3dbVBLzP11te.C) (is giving me the error that I have posted above)
```

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [February 15, 2021, 11:30am UTC](https://root-forum.cern.ch/t/getting-an-error-while-running-my-code/43545/9 "2021-02-15T11:30:53Z")

</div>

You need to use a proper histogram’s name (there is no histogram named “h”, as you can see).

---

<div class="post-metadata">

**Author:** ![robertfroast](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/robertfroast/32/21121_2.png) [@robertfroast](https://root-forum.cern.ch/u/robertfroast)\
**Post date:** [February 15, 2021, 11:49am UTC](https://root-forum.cern.ch/t/getting-an-error-while-running-my-code/43545/11 "2021-02-15T11:49:44Z")

</div>

@Wile_E_Coyote  
Thanks  
I got the program running when I changed the histogram name from h to that which is in the root file.
