Hi all,
I am trying to create a new class in PyROOT that inherits from TFile
:
import ROOT
class File(ROOT.TFile):
def __init__(self, filename, mode=""):
super().__init__(filename, mode)
# Advanced functions follow here...
Unfortunately, it seems that it does not properly handle the overloaded TFile constructors, because when I try to create an instance of this file via f = File("file.root", "READ)
the error message
super().__init__(filename, mode)
TypeError: none of the 2 overloaded methods succeeded. Full details:
TFile::TFile() =>
TypeError: takes at most 0 arguments (2 given)
no constructor available for 'TFile'
appears.
It does not even show the second C++ TFile constructor in this message which accepts a filename and the mode in which the file is opened (as well as the title and compression, which I don’t care about in the derived class).
Additional notes:
- It does not help to omit the
__init__
function. - Running
f = ROOT.TFile("file.root", "READ)
(of course) works as expected - ROOT Version: 6.22/00
- Python Version: 3.7.6
Looking forward for your help,
Daniel