# Output value for OpenTURNSPythonFunction.\_exec\_sample() method is not a 2d-sequence object

**URL:** <https://openturns.discourse.group/t/output-value-for-openturnspythonfunction-exec-sample-method-is-not-a-2d-sequence-object/193>\
**Category:** Python usage\
**Created:** [March 19, 2022, 10:41pm UTC](https://openturns.discourse.group/t/output-value-for-openturnspythonfunction-exec-sample-method-is-not-a-2d-sequence-object/193 "2022-03-19T22:41:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lucelorr](https://yyz2.discourse-cdn.com/free1/user_avatar/openturns.discourse.group/lucelorr/32/204_2.png) [@lucelorr](https://openturns.discourse.group/u/lucelorr)\
**Post date:** [March 19, 2022, 10:41pm UTC](https://openturns.discourse.group/t/output-value-for-openturnspythonfunction-exec-sample-method-is-not-a-2d-sequence-object/193/1 "2022-03-19T22:41:48Z")

</div>

Hi, all  
I have obtained the error:

```auto
Output value for OpenTURNSPythonFunction._exec_sample() method 
    is not a 2d-sequence object

```

This error came from simulation.py file. However, I do not know how to read this file and the meaning of this error.  
I am using OpenTURNS to compute probability of failure. I am calling OpenSeesPy a finite element software written in Python. I have to take into account that structural analysis could not converge. How I could do it? With an exception (try except)  
Thanks in advance  
Luis

---

<div class="post-metadata">

**Author:** ![sofianehaddad](https://yyz2.discourse-cdn.com/free1/user_avatar/openturns.discourse.group/sofianehaddad/32/46_2.png) [@sofianehaddad](https://openturns.discourse.group/u/sofianehaddad)\
**Post date:** [March 21, 2022, 8:26am UTC](https://openturns.discourse.group/t/output-value-for-openturnspythonfunction-exec-sample-method-is-not-a-2d-sequence-object/193/2 "2022-03-21T08:26:52Z")

</div>

Hello,  
How did you implement your Python function? The error is that your function should return 2d-sequences (something like `numpy array` with shape of size `2`)

---

<div class="post-metadata">

**Author:** ![JPelamatti](https://yyz2.discourse-cdn.com/free1/user_avatar/openturns.discourse.group/jpelamatti/32/101_2.png) [@JPelamatti](https://openturns.discourse.group/u/JPelamatti)\
**Post date:** [March 21, 2022, 12:49pm UTC](https://openturns.discourse.group/t/output-value-for-openturnspythonfunction-exec-sample-method-is-not-a-2d-sequence-object/193/3 "2022-03-21T12:49:22Z")

</div>

Hello,  
As Sofiane says, this issue seems to be related to the output type and size of your Python code (i.e., the function that calls OpenSeesPy).  
If you are using the `OpenTURNSPythonFunction` class ([API documentation](https://openturns.github.io/openturns/latest/user_manual/_generated/openturns.OpenTURNSPythonFunction.html?highlight=pythonfunction#openturns.OpenTURNSPythonFunction)), you need to make sure the \_exec() method returns an object of size 2 (e.g., list or numpy array). If you are using the `PythonFunction` class ([API documentation](https://openturns.github.io/openturns/latest/user_manual/_generated/openturns.PythonFunction.html)), you need to be sure that the (actual) python function you provide as a constructor parameter returns an object of size 2.  
If this does not help you solve this issue, would it be possible for you to share a small script that would allow us to reproduce the problem?  
Cheers
