Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetStrVal and Methods #156

Open
hcars opened this issue Apr 12, 2021 · 0 comments
Open

GetStrVal and Methods #156

hcars opened this issue Apr 12, 2021 · 0 comments

Comments

@hcars
Copy link

hcars commented Apr 12, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant