Provide error messages when CSVs not found at log location
This commit is contained in:
parent
c1aa1f795b
commit
3783992de5
1 changed files with 7 additions and 1 deletions
|
@ -15,10 +15,14 @@ else:
|
||||||
if settings.pomodoro_logfile():
|
if settings.pomodoro_logfile():
|
||||||
# This works for one file:
|
# This works for one file:
|
||||||
timelog = pd.read_csv(settings.pomodoro_logfile())
|
timelog = pd.read_csv(settings.pomodoro_logfile())
|
||||||
else:
|
if not timelog:
|
||||||
|
sys.exit("No logfile found at location specified for logfile.")
|
||||||
|
elif settings.pomodoro_logpath():
|
||||||
# For multiple files:
|
# For multiple files:
|
||||||
path = settings.pomodoro_logpath()
|
path = settings.pomodoro_logpath()
|
||||||
all_files = glob.glob(path + "*.csv")
|
all_files = glob.glob(path + "*.csv")
|
||||||
|
if not all_files:
|
||||||
|
sys.exit("No folder at location specified for logpath.")
|
||||||
|
|
||||||
li = []
|
li = []
|
||||||
|
|
||||||
|
@ -27,6 +31,8 @@ else:
|
||||||
li.append(df)
|
li.append(df)
|
||||||
|
|
||||||
timelog = pd.concat(li, axis=0, ignore_index=True)
|
timelog = pd.concat(li, axis=0, ignore_index=True)
|
||||||
|
else:
|
||||||
|
sys.exit("You must set either a logfile (single CSV) or a logpath (folder containing CSVs) in your settings.ini to use this script.")
|
||||||
|
|
||||||
if debug:
|
if debug:
|
||||||
imported = copy.deepcopy(timelog)
|
imported = copy.deepcopy(timelog)
|
||||||
|
|
Loading…
Add table
Reference in a new issue