Skip to content

Handling pgi.clib.glib.GSListPtr #43

@jim-easterbrook

Description

@jim-easterbrook

I've been experimenting with using the Gspell spell checking library from Python. The only difficulty I've encountered is with the value returned by Gspell.Checker.get_suggestions. When using PyGObject I get a Python list of strings, as expected. With pgi I get an object of type pgi.clib.glib.GSListPtr.

I've found a workaround as follows:

suggestions = checker.get_suggestions(word, -1)
result = []
for i in range(suggestions.length):
    c_str = ctypes.c_char_p(suggestions.nth_data(i))
    result.append(c_str.value.decode('utf_8'))
return result

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions