[IronPython] System.Exception: can't convert 66.6 to System.Int32

PhiHo Hoang phiho.hoang at rogers.com
Sat May 7 17:01:51 CEST 2005


Greetings,

    Why 66.6 cannot be converted to System.Int32 ?

    Thanks,

    PhiHo

>>> a
[333, 1234.5, 1, 333, -1, 66.6]
>>> a.sort()
System.InvalidOperationException: Failed to compare two elements in the
array. -
--> System.Exception: can't convert 66.6 to System.Int32
   at IronPython.Objects.Ops.ConvertTo(Object o, Type toType)
   at IronPython.Objects.Ops.Compare(Object x, Object y)
   at IronPython.Objects.List.DefaultPythonComparer.Compare(Object x, Object 
y)
   at System.Array.SorterObjectArray.QuickSort(Int32 left, Int32 right)
   --- End of inner exception stack trace ---
   at System.Array.SorterObjectArray.QuickSort(Int32 left, Int32 right)
   at System.Array.Sort(Array keys, Array items, Int32 index, Int32 length,
IComparer comparer)
   at IronPython.Objects.List.sort()
   at ReflectOpt.IronPython.Objects.List.sort(Object )
   at IronPython.Objects.BuiltinFunction.Call(Object arg0)
   at IronPython.Objects.Ops.Call(Object func, Object arg0)
   at IronPython.Objects.Method.Call()
   at IronPython.Objects.Ops.Call(Object func)
   at input_114.Run(Frame frame)
   at IronPython.Hosting.PythonEngine.DoOneInteractive(Frame topFrame)
   at IronPython.Hosting.PythonEngine.RunInteractive()
>>>




More information about the Ironpython-users mailing list