File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 1616
1717import atexit
1818import ctypes .util
19- import importlib .resources
2019import functools
2120import platform
2221import sys
2322from typing import (Any , Optional , TYPE_CHECKING )
2423
24+ # importlib.resources isn't available before Python 3.7, so if importing it
25+ # fails we import the backport.
26+ try :
27+ from importlib import resources
28+ except ImportError :
29+ import importlib_resources as resources
30+
2531from ._version import version as __version__
2632
2733if TYPE_CHECKING :
4248@functools .lru_cache ()
4349def get_library_path () -> Optional ["Path" ]:
4450 """@brief Returns the path to included library, if there is one."""
45- if importlib . resources .is_resource (__name__ , _LIBRARY_NAME ):
46- path_resource = importlib . resources .path (__name__ , _LIBRARY_NAME )
51+ if resources .is_resource (__name__ , _LIBRARY_NAME ):
52+ path_resource = resources .path (__name__ , _LIBRARY_NAME )
4753 path = path_resource .__enter__ ()
4854
4955 @atexit .register
You can’t perform that action at this time.
0 commit comments