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

Tom Unger <tunger-KIqD/[email protected]> Thu, 26 Apr 2018 21:13:34 +0000
Newsgroups gmane.comp.python.dotnet
Message-ID <DM5PR19MB0939E464FC3BFE6AC2AC49BED28E0@DM5PR19MB0939.namprd19.prod.outlook.com>
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

_________________________________________________
Python.NET mailing list - [email protected]
https://mail.python.org/mailman/listinfo/pythondotnet