[IronPython] Publishing a Module when Embedding
dinov at exchange.microsoft.com
Tue Jul 8 23:05:40 CEST 2008
You can just expose a DLR Scope object directly - which is what IronPython does for modules internally.
The name PythonModule is unfortunately a little confusing - it's actually a PythonScopeExtension where we can store additional data about the Scope (e.g. if import clr has occurred). We'll lazily create the PythonModule and associate it with the Scope if we need it.
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord
Sent: Tuesday, July 08, 2008 1:43 PM
To: Discussion of IronPython
Subject: [IronPython] Publishing a Module when Embedding
I've been looking at writing some examples of publishing a module in an
The straightforward example (which also appears in the DLR hosting spec)
is to just publish an *object*:
ScriptRuntime _runtime = ScriptRuntime.Create();
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
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#?
Users mailing list
Users at lists.ironpython.com
More information about the Ironpython-users