|
27 | 27 | import threading |
28 | 28 | import warnings |
29 | 29 |
|
| 30 | +from .. import _utils |
| 31 | + |
30 | 32 | # UPDATE_IF_PYTHON_VERSION_ADDED_OR_REMOVED : search for this string in codebase |
31 | 33 | # when support for a Python version must be added or removed |
32 | 34 |
|
|
50 | 52 | 'is %s' % _version) |
51 | 53 |
|
52 | 54 |
|
53 | | -_module_folder = os.path.dirname(os.path.realpath(__file__)) |
54 | | -_arch_filename = os.path.join(_module_folder, "_arch.txt") |
55 | 55 | success = False |
56 | 56 | firstExceptionMessage = '' |
57 | 57 | secondExceptionMessage = '' |
|
65 | 65 |
|
66 | 66 | if firstExceptionMessage: |
67 | 67 | try: |
68 | | - _arch_file = open(_arch_filename,'r') |
69 | | - _lines = _arch_file.readlines() |
70 | | - [_arch, _bin_dir,_engine_dir, _extern_bin_dir] = [x.rstrip() for x in _lines if x.rstrip() != ""] |
71 | | - _arch_file.close() |
72 | | - sys.path.insert(0,_engine_dir) |
73 | | - sys.path.insert(0,_extern_bin_dir) |
74 | | - |
75 | 68 | _envs = {'win32': 'PATH', 'win64': 'PATH'} |
76 | | - if _arch in _envs: |
77 | | - if _envs[_arch] in os.environ: |
78 | | - _env = os.environ[_envs[_arch]] |
79 | | - os.environ[_envs[_arch]] = _bin_dir + os.pathsep + os.environ[_envs[_arch]] |
| 69 | + _path_info = _utils.get_path_info() |
| 70 | + if _path_info.arch in _envs: |
| 71 | + if _envs[_path_info.arch] in os.environ: |
| 72 | + os.environ[_envs[_path_info.arch]] = _path_info.bin_folder + os.pathsep + os.environ[_envs[_path_info.arch]] |
80 | 73 | else: |
81 | | - os.environ[_envs[_arch]] = _bin_dir |
82 | | - os.add_dll_directory(_bin_dir) |
| 74 | + os.environ[_envs[_path_info.arch]] = _path_info.bin_folder |
| 75 | + os.add_dll_directory(_path_info.bin_folder) |
83 | 76 | if _PYTHONVERSION != '3_9' or _PYTHONVERSION != '3_10': |
84 | 77 | pythonengine = importlib.import_module("matlabengineforpython_abi3") |
85 | 78 | else: |
|
0 commit comments