# Cannot open file: TGraphErrors is Zombie

**URL:** <https://root-forum.cern.ch/t/cannot-open-file-tgrapherrors-is-zombie/35060>\
**Category:** Newbie\
**Created:** [July 8, 2019, 7:56pm UTC](https://root-forum.cern.ch/t/cannot-open-file-tgrapherrors-is-zombie/35060 "2019-07-08T19:56:58Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mike.z](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/m/6de8d8/32.png) [@mike.z](https://root-forum.cern.ch/u/mike.z)\
**Post date:** [July 8, 2019, 7:56pm UTC](https://root-forum.cern.ch/t/cannot-open-file-tgrapherrors-is-zombie/35060/1 "2019-07-08T19:56:58Z")

</div>

I’m completely new to Root and also to C++ coding. I’m going through the Root Primer and am trying to do the example in 2.5 for plotting measurements, which uses a file called “ExampleData.txt”, however I am getting an error when I try to execute the code. I have the file in the same folder as Root (as instructed).

Here is the code:  
TGraphErrors gr(“ExampleData.txt”);

Here is the error:  
Error in TGraphErrors::TGraphErrors: Cannot open file: ExampleData.txt, TGraphErrors is Zombie

As I said I am completely new to this, so thank you in advance for the help and patience.

---

<div class="post-metadata">

**Author:** ![vpadulan](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/vpadulan/32/25315_2.png) [@vpadulan](https://root-forum.cern.ch/u/vpadulan)\
**Post date:** [July 9, 2019, 7:11am UTC](https://root-forum.cern.ch/t/cannot-open-file-tgrapherrors-is-zombie/35060/2 "2019-07-09T07:11:39Z")

</div>

Hi @mike.z,  
That is probably because you don’t have `ExampleData.txt` file in the same directory where you are running ROOT prompt. You can download the data at [https://github.com/root-project/NotebookPrimer/tree/master/data](https://github.com/root-project/NotebookPrimer/tree/master/data), then try to replicate the example. Let me know should you have any more questions.  
Best,  
Vincenzo

---

<div class="post-metadata">

**Author:** ![mike.z](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/m/6de8d8/32.png) [@mike.z](https://root-forum.cern.ch/u/mike.z)\
**Post date:** [July 9, 2019, 4:49pm UTC](https://root-forum.cern.ch/t/cannot-open-file-tgrapherrors-is-zombie/35060/3 "2019-07-09T16:49:23Z")

</div>

Thank you for the response @vpadulan

I have the file in my root/bin directory. I think that is where root is running from. I source thisroot.sh from that directory. Maybe it is not the right one?

---

<div class="post-metadata">

**Author:** ![vpadulan](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/vpadulan/32/25315_2.png) [@vpadulan](https://root-forum.cern.ch/u/vpadulan)\
**Post date:** [July 10, 2019, 7:39am UTC](https://root-forum.cern.ch/t/cannot-open-file-tgrapherrors-is-zombie/35060/4 "2019-07-10T07:39:05Z")

</div>

Hi @mike.z,  
So I tried to reproduce your example from top to bottom.

> [@mike.z](#):
>
> I have the file in my root/bin directory.

I will then assume that you have a folder structure similar to the following

```auto
myfolder/
    ExampleData.txt
    root/
    build/
        ...
        bin/
            ...
            thisroot.sh

```

Since this would be the common/suggested way of having a local ROOT build on your machine (see [here](https://root.cern.ch/building-root) for reference).  
Then, typying `source myfolder/build/bin/thisroot.sh` will setup your current environment with ROOT.  
Now, while being inside `myfolder`, I type `root` to open the ROOT prompt. At the prompt, I type the following lines:

```auto
root [0] TGraphErrors gr("ExampleData.txt");
root [1] gr.Draw();
Info in <TCanvas::MakeDefCanvas>: created default TCanvas with name c1

```

And I correctly see the graph displayed. Tell me if you see anything wrong .  
Best,  
Vincenzo

_ROOT Version: 6.16_  
_Platform: CentOS_

---

<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:** [July 10, 2019, 8:45am UTC](https://root-forum.cern.ch/t/cannot-open-file-tgrapherrors-is-zombie/35060/5 "2019-07-10T08:45:19Z")

</div>

Please note that the “ExampleData.txt” file must be in your “current working directory”, NOT in the “${ROOTSYS}/bin” directory.

---

<div class="post-metadata">

**Author:** ![mike.z](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/m/6de8d8/32.png) [@mike.z](https://root-forum.cern.ch/u/mike.z)\
**Post date:** [July 10, 2019, 5:21pm UTC](https://root-forum.cern.ch/t/cannot-open-file-tgrapherrors-is-zombie/35060/6 "2019-07-10T17:21:24Z")

</div>

Thank you @Wile_E_Coyote and @vpadulan

I got it to work by following your instructions. My folder structure like this: Home/ROOT/root/bin/thisroot.sh

I didn’t understand what “working folder” meant, and thought it referred to the /bin folder with thisroot.sh. When I put the file in my Home folder then the graph loaded properly.

Thank you again for the help and patience.
