Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CannotOverwriteExistingCassetteException when no cassette exists is confusing #838

Open
The-Compiler opened this issue May 11, 2024 · 0 comments

Comments

@The-Compiler
Copy link

A trivial example such as:

import os.path
import urllib.request

import vcr

assert not os.path.exists("doesnotexist.yml")
with vcr.use_cassette("doesnotexist.yml", record_mode="none"):
    urllib.request.urlopen('http://www.iana.org/domains/reserved')

results in:

Traceback (most recent call last):
  [...]
  File "[...]/site-packages/vcr/stubs/__init__.py", line 263, in getresponse
    raise CannotOverwriteExistingCassetteException(
vcr.errors.CannotOverwriteExistingCassetteException: Can't overwrite existing cassette ('doesnotexist.yml') in your current record mode ('none').
No match for the request (<Request (GET) http://www.iana.org/domains/reserved>) was found.
No similar requests, that have not been played, found.

which seems confusing to me: The code failed because no cassette was found, yet the exception name and text claim "Can't override existing cassette".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant