[Python.NET] Embedding: finer control over module creation

Tom Unger tunger at mitem.com
Thu Apr 26 17:13:34 EDT 2018


I'm starting on a project to embed CPython into a .NET application for scripting.  The application currently uses IronPython, which is falling behind.  Our scripting needs are fairly extensive and I'm challenged by the limited information I find available.  First questions are about some finer grain control over

First, my application loads a number of scripts.  I currently use PythonEngine.ModuleFromString() and this works but I would like finer control.


  1.  Set the filename in call to Py_CompileString().  Current this is set to "none"
  2.  Set globals for module before executing it.  I put certain values in the scripts global space for convenience.

PythonEngine.Compile() will compile the code but then I don't see any way to execute the code.  Runtime.PyImport_ExecCodeModule(name, c); is not public.

Is there a way to do this with the current API?

If I fork the GIT repo, make changes that I need, are they likely to be incorporated?

Thanks,

Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythondotnet/attachments/20180426/49906cad/attachment-0001.html>


More information about the PythonDotNet mailing list