Commit 76f9ea39 authored by AlQuemist's avatar AlQuemist Committed by Wuttke, Joachim
Browse files

SWIG: Correct '__init__.py' for Windows

On Windows, the paths to the DLL files must be added via `os.add_dll_directory`;
otherwise, the module cannot be loaded.
parent 404b94ef
# init file for the Python package
# init file for the testing the Python package
import sys, os
# version
version_str = "@NSXTool_VERSION_MAJOR@.@NSXTool_VERSION_MINOR@.@NSXTool_VERSION_PATCH@"
version = (@NSXTool_VERSION_MAJOR@, @NSXTool_VERSION_MINOR@, @NSXTool_VERSION_PATCH@)
version_str = "@OpenHKL_VERSION_MAJOR@.@OpenHKL_VERSION_MINOR@.@OpenHKL_VERSION_PATCH@"
version = (@OpenHKL_VERSION_MAJOR@, @OpenHKL_VERSION_MINOR@, @OpenHKL_VERSION_PATCH@)
from .pynsx import *
# this is needed to adapt to the changes in Python 3.8 on Windows regarding dll loading
# see https://docs.python.org/3/whatsnew/3.8.html#ctypes
if sys.version_info >= (3, 8, 0) and sys.platform == 'win32':
if "PATH" in os.environ:
for p in os.environ['PATH'].split(';'):
if p and os.path.exists(p):
os.add_dll_directory(os.path.abspath(p))
from .pyohkl import *
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment