Hi Joe,
The model for the hostig APIs is that a module (represented by EngineModule) is
basically an IDictionary<string, object>, just like in Python (for the most
part).
The user can create a IDictionary<string, object> if she wants a customized
implementation of a dictionary. This will allow the user to override reads and
writes to the dictionary and implement logging, lazy lookup etc. For simple
scenarios, the simpler overloads of PythonEngine.CreateModule create an
Dictionary<string, object> for you.
We also removed the requirement of using SymbolIDs to simplify the API.
Instead, we translate to SymbolIDs under the hood.
All the properties of the DefaultModule are also exposed directly on the
PythonEngine for ease of use.
So your code can be adapted as such:
public static List get_analogous_concepts(string textnode)
{
try
{
cn_pe.SetStandardOutput(new
ConceptNetUtils.IPEWrapper.IPEStreamWrapper(IPEWrapper.IPEStreamWrapper.IPEngineResponse));
cn_pe.Global["textnode"] = textnode);
cn_pe.ExecuteToConsole("r={}");
cn_pe.ExecuteToConsole("r=c.get_analogous_concepts(textnode.encode('ascii','strict').strip())");
return (List)cn_pe.Globals["r"];
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), ex.Message);
//return ex.Message;
return List.MakeEmptyList(4);
}
}
Do you want to help develop Dynamic languages on CLR?
(http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038)
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of JoeSox
Sent: Wednesday, July 12, 2006 4:37 PM
To: Discussion of IronPython
Subject: Re: [IronPython] SetGlobal and GetGlobal in IPbeta 9
Ok, I am looking over the release notes one more time, and it looks
like I need to create a Dictionary<string, object> to store all of the
globals?
Do I need to also create a EngineModule?
This is why I am getting confused. Thanks
On 7/12/06, JoeSox <[EMAIL PROTECTED]> wrote:
> Sorry, I am now confused. I don't understand how I need to update my
> implementation of PythonEngine.SetGlobal and GetGlobal
_______________________________________________
users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
_______________________________________________
users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com