From 8a52d79bdc613826f2bb617601b7b7fdd3fe2769 Mon Sep 17 00:00:00 2001 From: Victor Nova Date: Thu, 4 Aug 2022 11:01:17 -0700 Subject: [PATCH] mention the need for PythonEngine.Initialize and BeginAllowThreads in the README --- README.rst | 2 ++ src/runtime/README.md | 3 +++ 2 files changed, 5 insertions(+) diff --git a/README.rst b/README.rst index c2c2d53e1..ba4a56fbf 100644 --- a/README.rst +++ b/README.rst @@ -50,6 +50,8 @@ Embedding Python in .NET (internal, derived from ``MissingMethodException``) upon calling ``Initialize``. Typical values are ``python38.dll`` (Windows), ``libpython3.8.dylib`` (Mac), ``libpython3.8.so`` (most other Unix-like operating systems). +- Then call ``PythonEngine.Initialize()``. If you plan to use Python objects from + multiple threads, also call ``PythonEngine.BeginAllowThreads()``. - All calls to python should be inside a ``using (Py.GIL()) {/* Your code here */}`` block. - Import python modules using ``dynamic mod = Py.Import("mod")``, then diff --git a/src/runtime/README.md b/src/runtime/README.md index ab75280ed..6c8eb2a6c 100644 --- a/src/runtime/README.md +++ b/src/runtime/README.md @@ -8,6 +8,9 @@ integrate Python engine and use Python libraries. (internal, derived from `MissingMethodException`) upon calling `Initialize`. Typical values are `python38.dll` (Windows), `libpython3.8.dylib` (Mac), `libpython3.8.so` (most other *nix). Full path may be required. +- Then call `PythonEngine.Initialize()`. If you plan to [use Python objects from + multiple threads](https://github.com/pythonnet/pythonnet/wiki/Threading), + also call `PythonEngine.BeginAllowThreads()`. - All calls to Python should be inside a `using (Py.GIL()) {/* Your code here */}` block. - Import python modules using `dynamic mod = Py.Import("mod")`, then