I can't open the root file

I have a program for working with root files. After launching, a window appears in which you can select a file. But when you select the desired file, the program gives the following errors:

Error in <TFile::TFile>: file /home/erg/Events_Oct13112559/1_1/*.root does not exist
Traceback (most recent call last):
  File "/home/erg/Horizon-T_baselinefit_MIPcalib_2ndBank.py", line 1282, in <module>
    openROOTfiles()
  File "/home/erg/Horizon-T_baselinefit_MIPcalib_2ndBank.py", line 164, in openROOTfiles
    readfileinitdata(selectedfiles[0])
  File "/home/erg/Horizon-T_baselinefit_MIPcalib_2ndBank.py", line 23, 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/Events_Oct13112559/1_1/*.root

I have attached the programs that are indicated in the errors

Horizon-T_baselinefit_MIPcalib_2ndBank.py (75.5 KB)
_tfile.py (3.1 KB)


ROOT Version: 6.30/04
Platform: Ubuntu
Compiler: pycharm community

Are you trying to open *.root. ? a file name with a wild card ?

I tried to open file from directory 1_1

Yes, but what is the file name ? the error message says “*.root” You cannot open multiple file using TFile.

I can’t open any root file from any directory.

Try:

$ ls /home/erg/Events_Oct13112559/1_1/*.root 

Pick one of the file names displayed by this command and do:

$ root
root [0] auto f = new TFile(" /home/erg/Events_Oct13112559/1_1/the_file_name_you_picked.rot")

It should work.

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