From 77581437f7a28fbfbc131d9529011be2b20a626b Mon Sep 17 00:00:00 2001 From: Josh Peak Date: Tue, 2 Jul 2019 13:53:36 +1000 Subject: [PATCH] fix IndexError when empty cassette throws CannotOverwriteCassetteException --- vcr/cassette.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcr/cassette.py b/vcr/cassette.py index 70ed20e..bbed20e 100644 --- a/vcr/cassette.py +++ b/vcr/cassette.py @@ -311,7 +311,7 @@ class Cassette(object): best_matches.sort(key=lambda t: t[0], reverse=True) # Get the first best matches (multiple if equal matches) final_best_matches = [] - previous_nb_success = best_matches[0][0] + previous_nb_success = 0 for best_match in best_matches: nb_success = best_match[0] # Do not keep matches that have 0 successes,