Sathish - If I understand correctly what you're asking, I think you might need to use the AsManagedObject method to retrieve the CLR object that a PyObject
wraps: PyObject ob = GetMyObject(...) Spam s = (Spam)ob.AsManagedObject(typeof(Spam)); hope this helps, -Brian On Jan 31, 2008 11:58 AM, Kaveripakam, Sathish < [EMAIL PROTECTED]> wrote: > Hi All, > > I am reading a PyObject from Python in C#. In C# code, I would like to > convert the PyObject to the user defined type. In this regard, I used the > call: > > <usrDefinedType> x = (usrDefinedType) Convert.ChangeType(pyObjectInstance > ,typeof(usrDefinedType)); > > The compilation went on fine, but during runtime, I got an error saying: > "Object must implement IConvertible". > > I was wondering, is there any other way to convert the PyObjects to > userdefined types ? > > Regards > > > > ------------------------------ > *Legal Notice:* > The information in this electronic transmission may contain confidential > or legally privileged information and is intended solely for the > individual(s) named above. If you are not an intended recipient or an > authorized agent, you are hereby notified that reading, distributing, or > otherwise disseminating, copying or taking any action based on the contents > of this transmission is strictly prohibited. Any unauthorized interception > of this transmission is illegal under law. If you have received this > transmission in error, please notify the sender by telephone [at the number > indicated above/on +41 58 928 0101] as soon as possible and then destroy all > copies of this transmission. > ------------------------------ > > _________________________________________________ > Python.NET mailing list - PythonDotNet@python.org > http://mail.python.org/mailman/listinfo/pythondotnet >
_________________________________________________ Python.NET mailing list - PythonDotNet@python.org http://mail.python.org/mailman/listinfo/pythondotnet