better error handling when cleaning old runs
This commit is contained in:
parent
3846e8f303
commit
572f43010e
@ -159,7 +159,10 @@ def print_runs(runs, clean=True):
|
|||||||
print("\n\n")
|
print("\n\n")
|
||||||
if clean:
|
if clean:
|
||||||
for run in runs:
|
for run in runs:
|
||||||
shutil.rmtree(run)
|
try:
|
||||||
|
shutil.rmtree(run)
|
||||||
|
except FileNotFoundError:
|
||||||
|
pass
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
time_format = '%Y-%m-%d_%H%M'
|
time_format = '%Y-%m-%d_%H%M'
|
||||||
@ -215,7 +218,10 @@ def main():
|
|||||||
if previous_runs:
|
if previous_runs:
|
||||||
print("Success after {} failed runs\n".format(len(previous_runs)))
|
print("Success after {} failed runs\n".format(len(previous_runs)))
|
||||||
print_runs(previous_runs.keys())
|
print_runs(previous_runs.keys())
|
||||||
shutil.rmtree(libdir)
|
try:
|
||||||
|
shutil.rmtree(libdir)
|
||||||
|
except FileNotFoundError:
|
||||||
|
pass
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
2
setup.py
2
setup.py
@ -5,7 +5,7 @@ with open('README.md', 'r') as fh:
|
|||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
name='cronwrapper',
|
name='cronwrapper',
|
||||||
version='0.1.2',
|
version='0.1.3',
|
||||||
author='Fredrik Eriksson',
|
author='Fredrik Eriksson',
|
||||||
author_email='feffe@fulh.ax',
|
author_email='feffe@fulh.ax',
|
||||||
description='A small wrapper to handle cronjob failures',
|
description='A small wrapper to handle cronjob failures',
|
||||||
|
Loading…
Reference in New Issue
Block a user