fix handling CTRL C

pull/10/head
Eren Golge 2018-01-24 08:17:49 -08:00
parent 2a20b7c2ac
commit d95a2ce26f
3 changed files with 4 additions and 3 deletions

View File

@ -42,7 +42,7 @@ def main(args):
def signal_handler(signal, frame):
print(" !! Pressed Ctrl+C !!")
remove_experiment_folder(OUT_PATH)
sys.exit(0)
sys.exit(1)
signal.signal(signal.SIGINT, signal_handler)
dataset = LJSpeechDataset(os.path.join(c.data_path, 'metadata.csv'),

Binary file not shown.

View File

@ -34,8 +34,9 @@ def remove_experiment_folder(experiment_path):
checkpoint_files = glob.glob(experiment_path+"/*.pth.tar")
if len(checkpoint_files) < 1:
shutil.rmtree(experiment_path)
print(" ! Run is removed from {}".format(experiment_path))
if os.path.exists(experiment_path):
shutil.rmtree(experiment_path)
print(" ! Run is removed from {}".format(experiment_path))
else:
print(" ! Run is kept in {}".format(experiment_path))