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
browsers.json not loading on Python 3.7, 3.8 & 3.9 #153
Comments
Does python3.7, 3.8, 3.9 all have If that might fix the issue using the backports. ps. Good catch btw! |
Like this: #154 |
But would this solve the problem? For some reason it's very hard to setup multiple different (virtual) python version environments locally. I could try to use docker I guess. |
https://github.com/nektos/act is useful for running workflows locally, but note I found it problematic on Windows. |
Yes, forcing using https://pypi.org/project/importlib-resources/ (https://github.com/python/importlib_resources) will work, as that is always more correct than the CPython stdlib version. |
Or here it is stated as well
https://setuptools.pypa.io/en/latest/userguide/datafiles.html#accessing-data-files-at-runtime |
I tried to fix it in v1.0.1 release. You can maybe validate it as well on our setup with the different Python releases? |
Thanks, this is now fixed. |
Ah right.. regarding the missing testcases, maybe I can just add that in pyproject.toml instead? I think this MANIFEST.in was redundant / unnecessary in several ways by now. Like so? packages = [
{ include = "tests"},
] |
Ya, there are newer ways of doing it now with various build backends. |
Indeed.
Well, that is not really the case anymore.. haha Try: import this |
Following on from #139 , there are still tests failing when there is no internet, but not failing on Python 3.10.
On Python 3.9, without internet, the failures are
In all cases, the log includes
Note these errors may not be seen in CI because they will fallback to fetching the data.
Note
browsers.json
is installed correctly.One logic problem is
https://github.com/fake-useragent/fake-useragent/blob/master/src/fake_useragent/utils.py#L10
As Python 3.7 have https://docs.python.org/3/library/importlib.resources.html , they wont try to import
importlib_resources
.The import needs to try to import
files
to see if it exists. That will fix Python 3.7 & 3.8, but doesnt explain why Python 3.9 is failing. It could be that Python 3.10.files()
works a bit better than Python 3.9.Note you can use https://pypi.org/project/pytest-socket/ to simulate no Internet.
The text was updated successfully, but these errors were encountered: