Thanks, I'm getting closer. Now I'm trying to find how to get a (new? current?) CodeContext to, for instance, call DictProxy.keys(..) The public constructor of CodeContext signature (a PythonDictionary and a ModuleContext) doesn't match the examples I could find (ScriptScope, LanguageContext).
Does anyone know of any examples of introspection of a hosted IP scripting from C#? Evidently there's a lot I'm missing here and would like to do the due homework first. I'm using NET 4 and don't need 2.x compatibility. Regards, -Hernán El 23/09/2011, a las 21:43, Dino Viehland escribió: > __class__ exists on object in python and is then inherited by the other > types. When accessing a member from > C# you get its view of the world which doesn't include Python object members. > To get the Python type I suggest calling DynamicHelpers.GetPythonType. > > Sent from my Windows Phone > > -----Original Message----- > From: Hernán Foffani > Sent: Friday, September 23, 2011 9:12 AM > To: ironpython-users@python.org > Subject: [Ironpython-users] instropection in an embedded engine > > > Having the following Python code: > > class Plugin: > def method(self): > pass > plugin = Plugin() > > and an embedded ScriptScope instance in my .NET application, > the following C# works fine > > dynamic plugin = pythonEngine.GetVariable("plugin"); > var attrs = plugin.__class__.__dict__; > > if Plugin python class was defined as an old-style class, but fails if > Plugin inherits from object (__class__ non existent). > > Under the VS debugger the dynamic object plugin shows as having three > attributes .class, .dict and .slots_and_weakref (with dots in their names) but > no __class__ or __dict__. > > I found that I could do something like plugin.method.im_class.__dict__ but > I'd rather stick with the common idiom. > > Is it a known issue? Something related to the way I'm using the engine? > > Thanks in advance, > -Hernán. > > _______________________________________________ > Ironpython-users mailing list > Ironpython-users@python.org > http://mail.python.org/mailman/listinfo/ironpython-users > _______________________________________________ Ironpython-users mailing list Ironpython-users@python.org http://mail.python.org/mailman/listinfo/ironpython-users