Transpose of 1 element array in COM object crashes python
sag at hydrosphere.com
Wed Dec 19 11:44:06 EST 2001
I am getting a COM error when I try to transpose a 1 element array
from within a COM object. The array is created by subclassing
UserArray. After the error, the application crashes and causes
PythonWin to die.
My questions are: why can't I get the transpose to work in a COM
situation, even tho it will work from the interactive window, and, even
if I cant' do this, why would the exception cause everything to die?
I know that transposing a 1 element array is silly, but in the code I
could be transposing an array of any size, it just happens to be 1
element in this case. It all works fine for arrays of > 1 element.
While I could special case for a 1 element case, I would expect
things to work for this, and am wondering if there are other caveats
out there to worry about.
The data in the array just before the transpose is:
year: value: 1791045.0 shape: (1,)
The code is:
data = Numeric.transpose(year)
#data =  I had been setting it to this, but things
crashed with no information, so I put in the raise to figure out what's
The error raised is:
com_error: (-2147352567, 'Exception occurred.', (0, 'Python COM
Server Internal Error', 'Unexpected Python Error:
exceptions.ValueError: invalid axis for this array', None, 0, -
After this, everything dies.
I'm using Python '2.1.1 (#20, Jul 20 2001, 01:19:29) [MSC 32 bit
More information about the Python-list