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: [email protected] 
[mailto:[email protected]] 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
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to