Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 52caf17

Browse files
committed
Add very simple initial load in pythonnet
1 parent f27d7be commit 52caf17

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

pythonnet/__init__.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import os
2+
3+
_RUNTIME = None
4+
5+
6+
def set_runtime(runtime):
7+
global _RUNTIME
8+
_RUNTIME = runtime
9+
10+
11+
def load():
12+
dll_path = os.path.join(os.path.dirname(__file__), "dlls", "Python.Runtime.dll")
13+
14+
assembly = _RUNTIME.get_assembly(dll_path)
15+
func = assembly["Python.Runtime.PythonEngine.InternalInitialize"]
16+
17+
if func(b"") != 0:
18+
raise RuntimeError("Failed to initialize Python.Runtime.dll")

0 commit comments

Comments
 (0)