[IronPython] .Net assembly expects array object, sees list
Jimmy Schementi
Jimmy.Schementi at microsoft.com
Tue May 18 06:14:14 CEST 2010
It's a feature; the IronPython .Net integration docs show how to go between Python lists and .NET arrays (http://ironpython.net/documentation/dotnet/dotnet.html#net-arrays):
System.Array[int]([1, 2, 3])
Basically you have to be very explicit about providing actual .NET types when they are expected.
~js
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Hank Fay
Sent: Monday, May 17, 2010 9:09 PM
To: Discussion of IronPython
Subject: [IronPython] .Net assembly expects array object, sees list
I don't know whether this is a bug or a feature. <s>
I'm using the Advantage ado.net<http://ado.net> data provider. On the AdsExtendedReader object is a method to Seek a value. The first parameter is supposed to be an array object, .Net type.
Here's my code:
_myArray = ["dProd"]
_ok = loReader.Seek(_myArray,AdsExtendedReader.SeekType.HardSeek)
and here is the result (in 2.6.1003.1), run in SharpDevelop:
Microsoft.Scripting.ArgumentTypeException: expected Array[object], got list
at Caller.Call
at BuiltinFunctionCaller<System.__Canon,System.__Canon,System.__Canon,System.__Canon,System.__Canon,System.Int32>.Call5
at System.Dynamic.UpdateDelegates.UpdateAndExecute7
at IronPython.Runtime.Importer.Import
at IronPython.Runtime.Operations.PythonOps.InitializeModule
at PythonMain.Main
TIA,
Hank Fay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20100518/bea16d67/attachment.html>
More information about the Ironpython-users
mailing list