[IronPython] [Bug] Arrays are stripped of .NET methods / properties
fuzzyman at voidspace.org.uk
Sat Jul 28 15:14:58 CEST 2007
A bug in IronPython 1.1. This one has bitten us and it would be very
nice to have it fixed.
Create a .NET array in one module and then use it in another module that
hasn't imported clr (or System) and it will be stripped of its .NET
methods and properties.
Importing clr fixes the problem, but shouldn't be necessary (right?).
To see this, create a module called 'createArray.py':
from System import Array
return Array.CreateInstance(int, 2, 2)
Then use the module from another IronPython program. E.g. :
from createArray import CreateArray
array = CreateArray()
This results in the following error:
Traceback (most recent call last):
File C:\testArray.py, line 4, in Initialize
AttributeError: 'Array[int]' object has no attribute 'Rank'
If you add an import clr to the program then it does the right thing...
More information about the Ironpython-users