Skip to content

TypeError: argument 'input': 'ndarray' object is not an instance of 'ndarray' #547

@mikelync

Description

@mikelync

When trying to capture an Array from Python using the following input scheme:

fn _set_node_vector<'py>(
    &mut self, 
    py: Python<'py>, 
    input: Bound<'py, numpy::PyArray1<Py<PyAny>>>,
) -> PyResult<()>

I have three cases:
a) Valid input: the array is correctly specified: v1 = np.array([1.0, 2.0], dtype=object)
b) Invalid i1 = np.array([1.0, 2.0]) (possibly because the dtype is float)
c) Invalid: i2 = np.array([[1.0, 2.0]], dtype=object) (shape is wrong)

In both invalid cases the error returned is:

TypeError: argument 'input': 'ndarray' object is not an instance of 'ndarray'

Bit more steering can be helpful...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions