X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=src%2Fbindings%2Fpython%2Fbt2%2Fbt2%2F__init__.py;fp=src%2Fbindings%2Fpython%2Fbt2%2Fbt2%2F__init__.py;h=73cc668831e9d33c15df0f23fe26a10e32c13e1b;hp=7068f2409474c02cbf1d62e04de6b160e8f0470a;hb=578f3d7758a335fd0405d55b5b17e18948a32f10;hpb=75daa1081c5cfee4197203dc826f30f58174fbac diff --git a/src/bindings/python/bt2/bt2/__init__.py b/src/bindings/python/bt2/bt2/__init__.py index 7068f240..73cc6688 100644 --- a/src/bindings/python/bt2/bt2/__init__.py +++ b/src/bindings/python/bt2/bt2/__init__.py @@ -20,8 +20,23 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. +import os import sys +# With Python ≥ 3.8 on Windows, the DLL lookup mechanism to load native +# modules doesn't search the `PATH` environment variable like everything +# else on this platform. +# +# See . +# +# Restore this behaviour by doing it manually. +if os.name == "nt" and sys.version_info >= (3, 8): + for path in os.getenv("PATH", "").split(os.pathsep): + if os.path.exists(path) and path != ".": + os.add_dll_directory(path) + +del os + # import all public names from bt2.clock_class import ClockClassOffset from bt2.clock_snapshot import _ClockSnapshotConst