Skip to content

client.execute(gql, variables) passes variable_values multiple times #292

@deifactor

Description

@deifactor

Calling client.execute(gql, variables) causes an exception along the lines of:

TypeError: execute() got multiple values for argument 'variable_values'
[... most of stacktrace omitted]
  File "[PATH TO EMPLOYER CODE OMITTED]", line 60, in <lambda>
    lambda: self.gql_client.execute(gql(query), variables),
  File "gql/client.py", line 193, in execute
    return self.execute_sync(document, *args, **kwargs)
  File "gql/client.py", line 137, in execute_sync
    return session.execute(document, *args, **kwargs)
  File "gql/client.py", line 442, in execute
    **kwargs,
  File "gql/client.py", line 361, in _execute
    **kwargs,

I believe this is because in Client.execute the variables get bundled up into *args, and then SyncClientSession.execute passes the variable_values parameter both in *args and explicitly.

Passing the variables as a keyword argument like client.execute(gql, variable_values=variables) appears to work, though I'm not 100% sure.

System info (please complete the following information):

  • OS: macOS 11.6
  • Python version: 3.7
  • gql version: 3.0.0
  • graphql-core version: 3.2.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugAn issue or pull request relating to a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions