[IronPython] SetGlobal and GetGlobal in IPbeta 9

JoeSox joesox at gmail.com
Thu Jul 13 01:27:14 CEST 2006


Sorry, I am now confused.  I don't understand how I need to update my
implementation of PythonEngine.SetGlobal and GetGlobal

I looked around in beta 9 and figured I probably figure it out faster
by posting here. And I am also wondering if I am going to lose some
scope.  I have a bunch of C# methods that look like this:
        public static List get_analogous_concepts(string textnode)
        {
            try
            {
                cn_pe.SetStandardOutput(new
ConceptNetUtils.IPEWrapper.IPEStreamWrapper(IPEWrapper.IPEStreamWrapper.IPEngineResponse));
                IronPython.Runtime.SymbolId textnode_SymbolId =
(SymbolId)"textnode";
                cn_pe.SetGlobal(textnode_SymbolId, textnode);


                IronPython.Runtime.SymbolId r_SymbolId = (SymbolId)"r";
                cn_pe.ExecuteToConsole("r={}");

cn_pe.ExecuteToConsole("r=c.get_analogous_concepts(textnode.encode('ascii','strict').strip())");

                return (List)cn_pe.GetGlobal(r_SymbolId);

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), ex.Message);
                //return ex.Message;
                return List.MakeEmptyList(4);
            }
        }


Do I need to use cn_pe.DefaultModule.Globals now? And if so, how?
Thanks
-- 
Later, Joe



More information about the Ironpython-users mailing list