Open
Description
GetStrVal is not working on TTables, returned by a method, when they are outside that method. Other methods to access numeric TTable entries are working. I have added a toy example of this issue below:
Python script to demonstrate problem
import snap
def my_reader_method(file_name):
schema = snap.Schema()
context = snap.TTableContext()
schema.Add(snap.TStrTAttrPr("Src", snap.atInt))
schema.Add(snap.TStrTAttrPr("Dst", snap.atInt))
schema.Add(snap.TStrTAttrPr("weight_1", snap.atStr))
delimiter = " "
ttable = snap.TTable.LoadSS(schema, file_name, context, delimiter, snap.TBool(False))
# This will work fine
print(ttable.GetStrVal("weight_1", 0))
ttable_iter = ttable.BegRI()
print(ttable_iter.GetStrAttr("weight_1"))
return ttable
ttable = my_reader_method("tests/systemtests/test_23/graph_23.edges")
try:
# This will error
print(ttable.GetStrVal("weight_1", 0))
except:
ttable_iter = ttable.BegRI()
# This will error
print(ttable_iter.GetStrAttr("weight_1"))
The example TTable file
0 1 adaf
Invocation
Invoke the above Python script with SNAP 6.0.0 and Python 3.8.5, and you should see the expected output print from inside the method and observe two errors outside the method.
Metadata
Metadata
Assignees
Labels
No labels