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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy