TBufferMerger and pyroot

Hi,

I’m having trouble using TBufferMerger in python/pyroot.

Trying this minimal code (adapted from the C++ example in the 2019 paper) in a single thread:

#!/usr/bin/env python3

import ROOT as r

def worker(tbufferMerger):
    tfileOutput = tbufferMerger.GetFile()
    hist = r.TH1F("test", "test", 100, 0, 100)
    tfileOutput.Write()


tBufferMerger = r.TBufferMerger("/tmp/testOutput.root", "recreate")
worker(tBufferMerger)

I obtain:

Error in <ROOT::TBufferMergerFile::Write const>: A const TFile object should not be saved. We try to proceed anyway.
TFile::Write:0: RuntimeWarning: file /tmp/testOutput.root not opened in write mode

Am I missing something?

Cheers,
Seth

ROOT Version: 6.26/04
Platform: linuxx8664gcc
Compiler: gcc11


Hello,
@pcanal should be able to help you on this problem.

Cheers

Lorenzo

TBufferFile::GetFile returns a std::shared_ptr<TFile*> and this seems to interfer here.

Maybe @vpadulan or @etejedor knows how to use them properly from PyROOT

Pinging @vpadulan and @etejedor again and keeping the topic open. It would be nice to get an answer.