# Segmentation Fault when no keyword arguments are passed

**URL:** https://discourse.paraview.org/t/segmentation-fault-when-no-keyword-arguments-are-passed/8469
**Category:** Development
**Tags:** python
**Created:** [November 23, 2021, 6:42pm UTC](https://discourse.paraview.org/t/segmentation-fault-when-no-keyword-arguments-are-passed/8469 "2021-11-23T18:42:14Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![theodorebaltis](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/t/e480ec/32.png) [@theodorebaltis](https://discourse.paraview.org/u/theodorebaltis)
#### Post date: [November 23, 2021, 6:42pm UTC](https://discourse.paraview.org/t/segmentation-fault-when-no-keyword-arguments-are-passed/8469/1 "2021-11-23T18:42:14Z")

</div>

When creating a source/filter in Python, a segmentation fault occurs if you do not pass any keyword arguments like: `r = XDMFReader()` or `c = Clip()`

 ![image](https://discourse.paraview.org/uploads/default/original/2X/d/dd849711177dd2f6657048fe0cdc7f14c3e4cdac.png)

Sometimes I think in VTK-terms where you can initialize a class and then set properties afterwards (`r = vtk.vtkXdmfReader(); r.SetFileName('fname')` or whatever) and it’s really frustrating to have it crash my current session.

I’m suggesting a check/catch be implemented in order to prevent this. I could potentially add this myself.  
I believe the implementation would go into paraview.simple module similar to how an `AttributeError` is raised if you misspell a keyword, or a `RuntimeError` if you pass the argument without a keyword.

Am I on the right track? Any potential issues with this or additional insight?

---

<div class="post-metadata">

### Author: ![aron.helser](https://discourse.paraview.org/user_avatar/discourse.paraview.org/aron.helser/32/13_2.png) [@aron.helser](https://discourse.paraview.org/u/aron.helser)
#### Post date: [November 29, 2021, 3:54pm UTC](https://discourse.paraview.org/t/segmentation-fault-when-no-keyword-arguments-are-passed/8469/2 "2021-11-29T15:54:25Z")

</div>

I’m pretty surprised this doesn’t work. It may be that we can fix the crash, and allow this usage pattern.

If I create a source first, like `s = Sphere()`, the crash goes away because the source is automatically used as input to the Clip filter. Inside ParaView I’m not seeing `r = XDMFReader()` crash - it just prints errors. Clip and Slice are not checking that `inputVector[0]->GetInformationObject(0)` is non-null. Several other filters can be created, with errors.

Are you seeing other filters crash? I’d file an issue, and see what approach is recommended there.

---

<div class="post-metadata">

### Author: ![theodorebaltis](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/t/e480ec/32.png) [@theodorebaltis](https://discourse.paraview.org/u/theodorebaltis)
#### Post date: [November 29, 2021, 4:12pm UTC](https://discourse.paraview.org/t/segmentation-fault-when-no-keyword-arguments-are-passed/8469/3 "2021-11-29T16:12:32Z")

</div>

@aron.helser I suppose using a filter like `Clip()` as the first item in a pipeline isn’t a great example, but nonetheless the behavior of “operation” filters is actually inconsistent. See below.

And I should add that before I was only testing with v5.9  
I’ve tested with v5.10-RC1 now as well and the behavior is a little different.

**As the first command in v5.9:**  
`XDMFReader()` crashes  
`Clip()` crashes  
`Threshold()` outputs errors

**As the first command in v5.10-RC1:**  
`XDMFReader()` outputs errors  
`Clip()` crashes  
`Threshold()` outputs errors

---

<div class="post-metadata">

### Author: ![aron.helser](https://discourse.paraview.org/user_avatar/discourse.paraview.org/aron.helser/32/13_2.png) [@aron.helser](https://discourse.paraview.org/u/aron.helser)
#### Post date: [November 30, 2021, 7:55pm UTC](https://discourse.paraview.org/t/segmentation-fault-when-no-keyword-arguments-are-passed/8469/4 "2021-11-30T19:55:45Z")

</div>

Filed an issue: [https://gitlab.kitware.com/paraview/paraview/-/issues/21111](https://gitlab.kitware.com/paraview/paraview/-/issues/21111)
