# issue with SelectCells

**URL:** https://discourse.paraview.org/t/issue-with-selectcells/2668
**Category:** Development
**Created:** [October 2, 2019, 8:37am UTC](https://discourse.paraview.org/t/issue-with-selectcells/2668 "2019-10-02T08:37:46Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![jfavre](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/j/b5ac83/32.png) [@jfavre](https://discourse.paraview.org/u/jfavre)
#### Post date: [October 2, 2019, 8:37am UTC](https://discourse.paraview.org/t/issue-with-selectcells/2668/1 "2019-10-02T08:37:46Z")

</div>

I am having an issue extracting data with the following code (Using PV5.7). SelectPoints() works fine. SelectCells() complains, although I can create an equivalent selection with 'Find Data". The error message is:

```
( 1.455s) [paraview] vtkPythonSelector.cxx:76 WARN| vtkPythonSelector (0x5620e4686e60): Could not invoke 'python_selector.execute()'
Error: Failed to evaluate Expression 'RTData <= 100'. The following exception stack should provide additional developer specific information. This typically implies a malformed expression. Verify that the expression is valid.

Traceback (most recent call last):
  File "/local/apps/ParaView/5.7/lib/python3.7/site-packages/paraview/detail/python_selector.py", line 79, in execute
    maskArray = calculator.compute(inputs, query, ns=elocals)
  File "/local/apps/ParaView/5.7/lib/python3.7/site-packages/paraview/detail/calculator.py", line 143, in compute
    retVal = eval(expression, globals(), mylocals)
  File "<string>", line 1, in <module>
NameError: name 'RTData' is not defined
Error: Failed to evaluate Expression 'RTData <= 100'. The following exception stack should provide additional developer specific information. This typically implies a malformed expression. Verify that the expression is valid.

```

The code is here:

```
from paraview.simple import *

w = Wavelet()
w.UpdatePipeline()

w2 = PointDatatoCellData(Input=w)
w2.PassPointData = 1
#w2.ProcessAllArrays = 1
w2.UpdatePipeline()

cdi = w2.GetCellDataInformation()
assert cdi.keys()[0] == 'RTData'

selection=SelectPoints()
selection.QueryString="RTData <= 100"
selection.FieldType = 'POINT'
selection.UpdatePipelineInformation()

# create a new 'Extract Selection'
mySelection = ExtractSelection(Input=w2, Selection=selection)
mySelection.UpdatePipeline()
Show(mySelection)

selection2=SelectCells()
selection2.QueryString="RTData <= 100"
selection2.FieldType = 'CELL'
selection2.UpdatePipelineInformation()

# create a new 'Extract Selection'
mySelection2 = ExtractSelection(Input=w, Selection=selection2)
mySelection2.UpdatePipeline()
Show(mySelection2)
```

---

<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: [October 2, 2019, 12:53pm UTC](https://discourse.paraview.org/t/issue-with-selectcells/2668/2 "2019-10-02T12:53:43Z")

</div>

With the script in the order you have posted, the  
`selection2=SelectCells()` operation is happening on the active source, which looks like it might be the `selection` object. Try specifying the input to the SelectCells() filter, or re-ordering things so that w2 is created right before selection2.

HTH,

Aron

---

<div class="post-metadata">

### Author: ![jfavre](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/j/b5ac83/32.png) [@jfavre](https://discourse.paraview.org/u/jfavre)
#### Post date: [October 2, 2019, 1:08pm UTC](https://discourse.paraview.org/t/issue-with-selectcells/2668/3 "2019-10-02T13:08:50Z")

</div>

Thanks @aron.helser. That did the trick. The lack of many examples and nobody to watch over my shoulder…

I also corrected my last ExtractSelection(Input=w2, Selection=selection2) with the correct Input, i.e. w2

problem solved. Back to the real data.

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.paraview.org/user_avatar/discourse.paraview.org/cory.quammen/32/11193_2.png) [@cory.quammen](https://discourse.paraview.org/u/cory.quammen)
#### Post date: [October 2, 2019, 1:35pm UTC](https://discourse.paraview.org/t/issue-with-selectcells/2668/4 "2019-10-02T13:35:24Z")

</div>

@jfavre FYI in master there is new selection API to make this simpler. See [https://gitlab.kitware.com/paraview/paraview/blob/master/Wrapping/Python/paraview/selection.py](https://gitlab.kitware.com/paraview/paraview/blob/master/Wrapping/Python/paraview/selection.py) for details.
