Skip to content

Commit

Permalink
Fix for case when no ROOT files are found
Browse files Browse the repository at this point in the history
  • Loading branch information
villekf committed Jul 18, 2024
1 parent a638f85 commit cd2138c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions source/Python/omegatomo/io/loadData.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,17 @@ def loadROOT(options, store_coordinates = False):
else:
files = glob.glob(os.path.join(options.fpath, '*.root'))
nFiles = len(files)
if nFiles == 0:
print('No files found! Please select a ROOT file')
import tkinter as tk
from tkinter.filedialog import askopenfilename
root = tk.Tk()
root.withdraw()
filename = askopenfilename(title='Select first ROOT file',filetypes=([('ROOT Files','*.root')]))
if not filename:
raise ValueError('No file was selected')
files = glob.glob(os.path.join(os.path.split(filename)[0], '*.root'))
nFiles = len(files)



Expand Down

0 comments on commit cd2138c

Please sign in to comment.