-
Notifications
You must be signed in to change notification settings - Fork 575
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
fix(provisional): traversable.read_text error handling #3314
Conversation
See #3310 / 7edec74 (cc @The-Compiler); we'll need to handle Then create |
I'm not entirely convinced this is the right fix. You seem to be getting a $ python3.10
Python 3.10.4 (main, Mar 23 2022, 23:05:40) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from importlib import resources
>>> traversable = resources.files("hypothesis.vendor") / "tlds-alpha-by-domain.txt"
>>> traversable
PosixPath('/usr/lib/python3.10/site-packages/hypothesis/vendor/tlds-alpha-by-domain.txt')
>>> _tlds = traversable.read_text().splitlines()
>>> _tlds[:5]
['# Version 2019080400, Last Updated Sun Aug 4 07:07:02 2019 UTC', 'AAA', 'AARP', 'ABARTH', 'ABB'] |
This does seem to be an installation problem, but if falling back to the older API fixes that I'm happy to take the patch and wait as packaging continues to improve. |
It might also obscure errors, however - especially if the old API vanishes in Python 3.12+ somewhen. |
It'll certainly become an error sometime (most likely in ~3 years when Hypothesis drops Python 3.8 support), but I'm hoping that we'll have better handling and/or it'll be less common then. For today, I'd rather have a working fallback than even a helpful error message, and I don't think we can even deliver the latter. Reasonable to leave a comment mentioning |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again @mabdinur 💖
traversable.read_text
raises a ValueError in python 3.10Sample Error with
hypothesis==6.45.1
: