Hello all,

I've been looking at writing some examples of publishing a module in an embedded scenario.

The straightforward example (which also appears in the DLR hosting spec) is to just publish an *object*:

         ScriptRuntime _runtime = ScriptRuntime.Create();
           _runtime.Globals.SetVariable("ModuleName", someObject);

What I *really* want to do is to create a PythonModule from a dictionary of objects and publish that into the runtime globals.

Creating a populated PythonModule seems to be problematic. The useful overload of PythonCOntext.CreateModule (that takes 4 arguments) isn't public (internal) - I can't see how to populate the module once I've created one.

There is also an internal constructor to PythonModule that takes a Scope. These seem to be the routes taken by the importer.

You can't publish a dictionary (well - except as a dictionary).

How can I create and populate a PythonModule from C#?

Michael Foord

--
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/
http://www.trypython.org/
http://www.ironpython.info/
http://www.theotherdelia.co.uk/
http://www.resolverhacks.net/

_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to