# Error saving TH1F histogram in TDirectory

**URL:** <https://root-forum.cern.ch/t/error-saving-th1f-histogram-in-tdirectory/58235>\
**Category:** Newbie\
**Tags:** python, hist, root\
**Created:** [February 21, 2024, 3:51pm UTC](https://root-forum.cern.ch/t/error-saving-th1f-histogram-in-tdirectory/58235 "2024-02-21T15:51:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![helton](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/8797f3/32.png) [@helton](https://root-forum.cern.ch/u/helton)\
**Post date:** [February 21, 2024, 3:51pm UTC](https://root-forum.cern.ch/t/error-saving-th1f-histogram-in-tdirectory/58235/1 "2024-02-21T15:51:17Z")

</div>

_ROOT Version:JupyROOT 6.30/02_\_

Hello experts,  
I am trying to save a TH1F histogram in a TDirectory of a .root file. When I then try to open this .root file with TBrowser for example, I get these error lines:  
Error in TList::Clear: A list is accessing an object (0x288d9f0) already deleted (list name = TList)  
Error in TList::Clear: A list is accessing an object (0x288de70) already deleted (list name = TList)  
… (many more lines)

This is the code to produce this:

```auto
outfile = ROOT.TFile("data.root", "RECREATE")
nomi = outfile.mkdir("nominal")
nomi.cd()
reco_ttbar = ROOT.TH1F("reco_ttbar_m", "data_ttbar_m", 87, 0, 2001)
for v in pred:
    reco_ttbar.Fill(v)
reco_ttbar.Write()
outfile.cd()
outfile.Close()

```

When I dont do .Close() these errors disapear, but then of course I get the warning about not properly closing the file. Hope someone can help me out.  
Cheers

---

<div class="post-metadata">

**Author:** ![LongHoa](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/longhoa/32/25905_2.png) [@LongHoa](https://root-forum.cern.ch/u/LongHoa)\
**Post date:** [February 22, 2024, 3:58am UTC](https://root-forum.cern.ch/t/error-saving-th1f-histogram-in-tdirectory/58235/2 "2024-02-22T03:58:02Z")

</div>

Hello,

This seem to be the technical issue cause by the difference in ROOT version.  
If you create the root file by any version \>= 6.30, then you read the same file using any version \< 6.30, this error will show up.

You may want to try reading it by ROOT 6.3X or above.

Cheers,  
Hoa.

---

<div class="post-metadata">

**Author:** ![helton](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/8797f3/32.png) [@helton](https://root-forum.cern.ch/u/helton)\
**Post date:** [February 22, 2024, 7:26pm UTC](https://root-forum.cern.ch/t/error-saving-th1f-histogram-in-tdirectory/58235/3 "2024-02-22T19:26:04Z")

</div>

Hello Hoa,

indeed this was the problem. Thanks!  
Cheers
