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

Importlib ModuleNotFoundError python 3.7.0 #32

Closed
ben-edna opened this issue Nov 13, 2020 · 2 comments · Fixed by #241
Closed

Importlib ModuleNotFoundError python 3.7.0 #32

ben-edna opened this issue Nov 13, 2020 · 2 comments · Fixed by #241
Assignees
Labels
bug Something isn't working dependencies Packages this project depends on

Comments

@ben-edna
Copy link
Contributor

dfetch uses importlib to find the reosurces in the package (template.yaml, schema).
Users with pythn 3.7.0 report:

ModuleNotFoundError: No module named 'importlib.resources'

When running dfetch nder python 3.7.0

importlib.resources should be part of 3.7.0, to be investigated.

@ben-edna ben-edna added bug Something isn't working dependencies Packages this project depends on labels Nov 13, 2020
@ben-edna ben-edna self-assigned this Nov 13, 2020
@ben-edna
Copy link
Contributor Author

Workaround is to install a newer version, python 3.7.9 is reported to work

@KrisEDNA
Copy link
Contributor

Work-around (tested on python 3.6.5):

pip install importlib-resources
--- a/dfetch/resources/__init__.py
+++ b/dfetch/resources/__init__.py
@@ -1,6 +1,9 @@
 """Resources needed when dfetch is distributed."""

-import importlib.resources as pkg_resources
+try:
+    import importlib.resources as pkg_resources
+except ModuleNotFoundError:
+    import importlib_resources as pkg_resources

 from dfetch import resources  # pylint: disable=import-self

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dependencies Packages this project depends on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants