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

Usingvars breaks my pyjq.first command with Assertion failed: (JVP_HAS_KIND(key, JV_KIND_STRING)) #85

Open
jonsnowseven opened this issue Jul 3, 2024 · 0 comments

Comments

@jonsnowseven
Copy link

jonsnowseven commented Jul 3, 2024

Hello.

I am having the following issue regarding the use of vars argument.

This does not work:

data = dict(
    parameters= [
        dict(name="PKG_TAG_NAME", value="trunk"),
        dict(name="GIT_COMMIT", value="master"),
        dict(name="TRIGGERED_JOB", value="trunk-buildall")
    ],
    id="2013-12-27_00-09-37",
    changeSet=dict(items=[], kind="git"),
)
import pyjq
print(pyjq.first('$parameters[] | {"param_name": .name, "param_type": .type}', vars=data))

# returns Assertion failed: (JVP_HAS_KIND(key, JV_KIND_STRING)), function jv_object_set, file jv.c, line 1771.

But this works:

data = dict(
    parameters= [
        dict(name="PKG_TAG_NAME", value="trunk"),
        dict(name="GIT_COMMIT", value="master"),
        dict(name="TRIGGERED_JOB", value="trunk-buildall")
    ],
    id="2013-12-27_00-09-37",
    changeSet=dict(items=[], kind="git"),
)
import pyjq
print(pyjq.first('.parameters as $parameters | $parameters[] | {"param_name": .name, "param_type": .type}', data))

# {'param_name': 'PKG_TAG_NAME', 'param_type': None}

Am I assuming something wrong regarding the use of vars?

I am using Python 3.11 and pyjq 2.6.0 in a Macbook M2.

Thank you in advance.

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