Hi, I have an issue while selecting Cells by string array value.
This is my query:
QuerySelect(QueryString='(Name == 3_S_8_qwerty-0_ytrewq7)&(Type == SomeType)', FieldType='CELL', InsideOut=0)
and this is an error I’m getting as a result:
Name == 3_S_8_room-0_wall7
SyntaxError: invalid decimal literal
Obviously it takes my string value as a number, due to leading decimal. Also, in case I put underscore in front of the string
_3_S_8_qwerty-0_ytrewq7 it will give me the same error but related to the text after
So the question is: are there any ways to set that string as a value to compare to (without changing/encoding/normalizing the
Name values as input)?
PS: quotes didn’t help.
PPS: i know that it supports
numpy features. Maybe there is something I’ve missed regarding strings comparison?
As I’ve mentioned in PS, quotes didn’t work: error was gone, but result was wrong (nothing was found/selected).
Can you share your data ?
Sorry, I’m not allowed to share it here. But I can describe how it is being generated.
CellData is extended on import by manually added String arrays.
Name array is added along with them.
Input is a vtp, where each piece has some metadata added along with tag:
We parse the file with
vtkXMLPolyDataReader and generate a MultiblockDataSet as our custom reader’s output. Along with copying every piece to a separate block, we read metadata from the same file using
xml.etree.ElementTree. The metadata values are added as a separate vtkStringArray to the block’s CellData.
PS: Hope I didn’t describe it too complicated.
PPS: maybe there is a better way to get attributes per piece from
I suspect that you are seeing underscore grouping PEP 515 – Underscores in Numeric Literals | peps.python.org. It is probably seeing the underscore after the digit as a grouping for numeric values so it’s treating the string as numeric hence the error. Escaping the underscore might fix it.