Errors in code for root file

There is a code that is designed to consider a root file with a lot of events. The file itself is attached here. After the launch, the following warnings occur:

Error in <TFile::TFile>: file /home/erg/*.root does not exist
Traceback (most recent call last):
  File "/home/erg/PycharmProjects/pythonProject1/.idea/accident.py", line 1558, in <module>
    openimagefilename(0, True)
  File "/home/erg/PycharmProjects/pythonProject1/.idea/accident.py", line 761, in openimagefilename
    readfileinitdata(imagefilename[0])
  File "/home/erg/PycharmProjects/pythonProject1/.idea/accident.py", line 96, in readfileinitdata
    tempfile = ROOT.TFile.Open(filename)
  File "/home/erg/root/lib/ROOT/_pythonization/_tfile.py", line 67, in _TFileOpen
    raise OSError('Failed to open file {}'.format(str(args[0])))
OSError: Failed to open file /home/erg/*.root

accident.py (76.1 KB)

_ROOT Version: 6.26/10
_Platform:
_Compiler: pycharm community


TFile does not accept wildcards, you have to pass only one file name to it. If you want to “concatenate” files, you can use TChain, which accepts wildcards when you Add files to the chain.

I changed * for real file name.
The code has a string:

tempheadertree.GetEvent()

But t need at least 1 arguments (0 given)
What i can do?

tempheadertree.GetEvent(0)

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.