equal
deleted
inserted
replaced
59 from importlib import resources # pytype: disable=import-error |
59 from importlib import resources # pytype: disable=import-error |
60 |
60 |
61 # Force loading of the resources module |
61 # Force loading of the resources module |
62 resources.open_binary # pytype: disable=module-attr |
62 resources.open_binary # pytype: disable=module-attr |
63 |
63 |
|
64 # py2exe raises an AssertionError if uses importlib.resources |
|
65 if getattr(sys, "frozen", None) in ("console_exe", "windows_exe"): |
|
66 raise ImportError |
|
67 |
64 except (ImportError, AttributeError): |
68 except (ImportError, AttributeError): |
65 # importlib.resources was not found (almost definitely because we're on a |
69 # importlib.resources was not found (almost definitely because we're on a |
66 # Python version before 3.7) |
70 # Python version before 3.7) |
67 |
71 |
68 def open_resource(package, name): |
72 def open_resource(package, name): |