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

Add better error message if parent path exists but isn't a directory #434

Merged
merged 1 commit into from Oct 10, 2021
Merged

Add better error message if parent path exists but isn't a directory #434

merged 1 commit into from Oct 10, 2021

Conversation

JWCook
Copy link
Member

@JWCook JWCook commented Oct 10, 2021

Fixes #433

Instead of a confusing error message like:

AttributeError: 'SQLiteDict' object has no attribute '_local_context'`

Show this error message:

FileExistsError: Parent path exists and is not a directory: <path>. Please either delete the file or choose a different path.

This applies to SQLiteDict, SQLitePickleDict, and FileDict.

This also creates _local_context earlier in SQLiteDict.__init__() so any other potential initialization errors won't attempt to reference _local_context before it's created.

@JWCook JWCook added the bug label Oct 10, 2021
@JWCook JWCook added this to the v0.8 milestone Oct 10, 2021
@codecov-commenter
Copy link

codecov-commenter commented Oct 10, 2021

Codecov Report

Merging #434 (9f8027f) into master (e9f425d) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #434   +/-   ##
=======================================
  Coverage   98.72%   98.72%           
=======================================
  Files          17       17           
  Lines        1173     1176    +3     
  Branches      144      144           
=======================================
+ Hits         1158     1161    +3     
  Misses          5        5           
  Partials       10       10           
Impacted Files Coverage Δ
requests_cache/backends/sqlite.py 98.71% <100.00%> (+0.02%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e9f425d...9f8027f. Read the comment docs.

@JWCook JWCook merged commit 01dda0c into requests-cache:master Oct 10, 2021
@JWCook JWCook deleted the fix-init-error branch October 10, 2021 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AttributeError: 'DbPickleDict' object has no attribute '_local_context'
2 participants