# No attribute 'Write'

**URL:** <https://root-forum.cern.ch/t/no-attribute-write/56635>\
**Category:** Newbie\
**Tags:** python, hist\
**Created:** [October 7, 2023, 10:35am UTC](https://root-forum.cern.ch/t/no-attribute-write/56635 "2023-10-07T10:35:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Annzm](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/annzm/32/34693_2.png) [@Annzm](https://root-forum.cern.ch/u/Annzm)\
**Post date:** [October 7, 2023, 10:35am UTC](https://root-forum.cern.ch/t/no-attribute-write/56635/1 "2023-10-07T10:35:20Z")

</div>

Hi Everyone  
i trying to create some histograms and want to save them into a root file.

```py
kinPlots = HistGroup('kinPlots')

    kinPlots.Add('MET_pt',self.a.GetActiveNode().DataFrame.Histo1D<float>(('MET_pt','MET_pt',40,0,1000),'MET_pt','weight__nominal'))
    kinPlots.Add('Lead_pt',self.a.GetActiveNode().DataFrame.Histo1D<float>(('Lead_pt','Lead_pt',34,300,2000),'Lead_pt','weight__nominal'))
    kinPlots.Add('Sublead_pt',self.a.GetActiveNode().DataFrame.Histo1D<float>(('Sublead_pt','Sublead_pt',36,200,2000),'Sublead_pt','weight__nominal'))
    kinPlots.Add('DeltaPhi_Higgs_Wqq',self.a.GetActiveNode().DataFrame.Histo1D<float>(('DeltaPhi_Higgs_Wqq','DeltaPhi_Higgs_Wqq',30,-3.2,3.2),'DeltaPhi_Higgs_Wqq','weight__nominal'))
    kinPlots.Add('DeltaR_Higgs_Wqq',self.a.GetActiveNode().DataFrame.Histo1D<float>(('DeltaR_Higgs_Wqq','DeltaR_Higgs_Wqq',25,0,5),'DeltaR_Higgs_Wqq','weight__nominal'))
    kinPlots.Add('Higgs_msoftdrop',self.a.GetActiveNode().DataFrame.Histo1D<float>(('Higgs_msoftdrop','Higgs_msoftdrop',40,50,250),'Higgs_msoftdrop','weight__nominal'))
    kinPlots.Add('Wqq_msoftdrop',self.a.GetActiveNode().DataFrame.Histo1D<float>(('Wqq_msoftdrop','Wqq_msoftdrop',40,50,250),'Wqq_msoftdrop','weight__nominal'))

filename = '{}_{}_abc.txt'.format(setname,year) 

    ana = XHYbbWW(filename,ijob,njobs)

outFile = ROOT.TFile.Open('{}_{}_{}_studies.root'.format(ana.setname,ana.year,ana.ijob),'RECREATE')
    outFile.cd()

    kinPlots = KinPlots(ana)
    kinPlots.Do('Write')

```

but im encountring this error

```auto
    kinPlots.Do('Write')
  File "/TIMBER/TIMBER/Analyzer.py", line 1880, in Do
    out = getattr(hist,THmethod)(*argsTuple)
AttributeError: 'bool' object has no attribute 'Write'

```

any idea how to fix this issue.  
thanks in Advance.

---

<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 8, 2023, 5:54am UTC](https://root-forum.cern.ch/t/no-attribute-write/56635/2 "2023-10-08T05:54:26Z")

</div>

Hi,

Interesting question. The error message seems to be quite informative: the method `Write` is called on a boolean rather than a histogram. The variable seems to be `hist` at line 1880 of `Analyzer.py`.  
From the context given, it’s not easy to guess further. Some debugging of your code seems to be in order, perhaps starting with some printouts of the variable hist, to then move to something more sophisticated in case no solution is found.

I hope this helps!

Cheers,  
D
