Hello,
I’ve been using the following function in pyROOT for a long time with success:
def GetFileNameFromDialog(mode=0):
if mode==0: mode_str = "kFDSave"
elif mode==1: mode_str = "kFDOpen"
fi = ROOT.gROOT.ProcessLine("TGFileInfo* fi = new TGFileInfo; new TGFileDialog(gClient->GetRoot(), gClient->GetRoot(), "+mode_str+", fi); fi;")
myfi = ROOT.BindObject(fi, ROOT.TGFileInfo)
ROOT.SetOwnership(myfi, True)
fn = myfi.fFilename
#return myfi.fFilename
return fn, myfi, fi
Recently I made adjustements in my code replacing TTrees by TChain and I think the above function corrupts the memory in some way, since, as you can see, it has nothing directly to do with the Trees that I am using in my code.
In general, when my code works on a chain containing a single Tree, everything is OK. When a chain contains more, the chain gets corrupted just after calling this function:
Error in <TFile::TFile>: file allpackets-TA-ACQUISITION-20150918-041406-gaintable_20150516.txt-Cosmic20deg0414.root does not exist
the file of course exists and was displayed just before opening the file dialog. I can’t give a working example, so I need to ask - is there anything obvious in the function shown above, that could corrupt the memory? I am using ROOT 5.34.36