Skip to content
This repository was archived by the owner on Jul 22, 2023. It is now read-only.

Commit 52caf17

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

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

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)