From 44cc5afea6af942d7ecf7e80fef5520e7b33509d Mon Sep 17 00:00:00 2001 From: TheJanzap Date: Thu, 22 Aug 2024 11:32:33 +0200 Subject: [PATCH 1/4] Add `Runtime.PythonDLL` to C# example in README --- README.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/README.rst b/README.rst index f2907f43a..e922f4dff 100644 --- a/README.rst +++ b/README.rst @@ -85,6 +85,7 @@ Example static void Main(string[] args) { + Runtime.PythonDLL = "python38.dll"; PythonEngine.Initialize(); using (Py.GIL()) { From 2f69bd3adff08f370a8d622d84bee21f4fbb2c06 Mon Sep 17 00:00:00 2001 From: TheJanzap Date: Thu, 22 Aug 2024 11:50:09 +0200 Subject: [PATCH 2/4] doc: Add different methods to reference Python DLL --- doc/source/dotnet.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/source/dotnet.rst b/doc/source/dotnet.rst index ed2b741a7..9303db8d8 100644 --- a/doc/source/dotnet.rst +++ b/doc/source/dotnet.rst @@ -15,7 +15,9 @@ These classes include PyObject, PyList, PyDict, PyTuple, etc. At a very high level, to embed Python in your application one will need to: -- Reference ``Python.Runtime.dll`` (e.g. via a ``PackageReference``) +- Reference ``Python.Runtime.dll`` (e.g. via a ``PackageReference``, + the ``Runtime.PythonDLL`` property or the ``PYTHONNET_PYDLL`` + environment variable) - Call ``PythonEngine.Initialize()`` to initialize Python - Call ``var mod = PyModule.Import(name)`` to import a module as ``mod`` From 243daceef6ff15c4e5b286e98f1ff2ccaba1cf72 Mon Sep 17 00:00:00 2001 From: TheJanzap Date: Tue, 27 Aug 2024 10:16:48 +0200 Subject: [PATCH 3/4] doc: Create separate bullet point for Python DLL --- doc/source/dotnet.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/source/dotnet.rst b/doc/source/dotnet.rst index 9303db8d8..f657c1261 100644 --- a/doc/source/dotnet.rst +++ b/doc/source/dotnet.rst @@ -15,9 +15,9 @@ These classes include PyObject, PyList, PyDict, PyTuple, etc. At a very high level, to embed Python in your application one will need to: -- Reference ``Python.Runtime.dll`` (e.g. via a ``PackageReference``, - the ``Runtime.PythonDLL`` property or the ``PYTHONNET_PYDLL`` - environment variable) +- Reference ``Python.Runtime.dll`` (e.g. via a ``PackageReference``) +- Set the Python library the code should run with via the ``Runtime.PythonDLL`` + property or the ``PYTHONNET_PYDLL`` environment variable - Call ``PythonEngine.Initialize()`` to initialize Python - Call ``var mod = PyModule.Import(name)`` to import a module as ``mod`` From 353bb26b5ecc66b6629e304e751bba82d344a7dd Mon Sep 17 00:00:00 2001 From: TheJanzap Date: Tue, 27 Aug 2024 10:24:21 +0200 Subject: [PATCH 4/4] README: Add comment about setting Python DLL to example --- README.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.rst b/README.rst index e922f4dff..a8e651890 100644 --- a/README.rst +++ b/README.rst @@ -85,6 +85,8 @@ Example static void Main(string[] args) { + // The Python library can also be set with the `PYTHONNET_PYDLL` env var + // or dynamically with a library like https://github.com/losttech/WhichPython Runtime.PythonDLL = "python38.dll"; PythonEngine.Initialize(); using (Py.GIL())