[Python.NET] converting Pyobject to user defined type data structures

Kaveripakam, Sathish Sathish.Kaveripakam at phonak.com
Thu Jan 31 17:58:35 CET 2008


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. 
********************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/pythondotnet/attachments/20080131/9d81d1c7/attachment.htm 


More information about the PythonDotNet mailing list