Bladed Knowledge Base

Exception occurs calling DotNetArrayToNumpy() function in Python Results API
Category: Bladed API

Problem

Bladed versions affected: all current 4.x versions 
Date of last article update: 20th March 2023

=========================================================================

An exception is thrown at the following line within the DotNetArrayToNumpy() function in the Python implementation of the Results API (in the ResultsApiUtils.py file):

src_ptr = dotNetArray.PointerToFirstElement.ToInt32()

The exception is:

AttributeError: 'IDisposableReadOnlyList[Double]' object has no attribute 'PointerToFirstElement'

Solution

This exception occurs if version 3.0.1 (or later) of the pythonnet package is being used.

Please downgrade the version of the pythonnet package to version 2.5.2.





Keywords Python Results API pythonnet