graphQL python 示例代码中的错误
Error in graphQL python example code
我开始研究 GraphQL,因为我来自 python 背景,所以我将 GraphQL 与 Python 一起使用。
我按照此处提供的步骤进行操作 Link,但我仍然面临问题。
An error occurred while resolving field Query.hello
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/graphql/execution/executor.py", line 311, in resolve_or_error
return executor.execute(resolve_fn, source, info, **args)
File "/usr/local/lib/python3.5/dist-packages/graphql/execution/executors/sync.py", line 7, in execute
return fn(*args, **kwargs)
TypeError: resolve_hello() missing 2 required positional arguments: 'context' and 'info'
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/graphql/execution/executor.py", line 330, in complete_value_catching_error
exe_context, return_type, field_asts, info, result)
File "/usr/local/lib/python3.5/dist-packages/graphql/execution/executor.py", line 383, in complete_value
raise GraphQLLocatedError(field_asts, original_error=result)
graphql.error.located_error.GraphQLLocatedError: resolve_hello() missing 2 required positional arguments: 'context' and 'info'
None
请帮我解决问题。
你在这里没有提供太多信息,也许触发错误的代码会有所帮助,但谷歌搜索我发现了一些相关帖子
https://github.com/graphql-python/graphene/issues/601
https://github.com/graphql-python/graphene-django/issues/282
也许检查一下您在第一个提到的版本中使用的版本 link
graphQL 文档似乎已过时。 Graphene-python 2 更改了方法签名。试试这样的方法
def resolve_hello(self, info, **kwargs):
return 'Hello world!'
我开始研究 GraphQL,因为我来自 python 背景,所以我将 GraphQL 与 Python 一起使用。 我按照此处提供的步骤进行操作 Link,但我仍然面临问题。
An error occurred while resolving field Query.hello
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/graphql/execution/executor.py", line 311, in resolve_or_error
return executor.execute(resolve_fn, source, info, **args)
File "/usr/local/lib/python3.5/dist-packages/graphql/execution/executors/sync.py", line 7, in execute
return fn(*args, **kwargs)
TypeError: resolve_hello() missing 2 required positional arguments: 'context' and 'info'
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/graphql/execution/executor.py", line 330, in complete_value_catching_error
exe_context, return_type, field_asts, info, result)
File "/usr/local/lib/python3.5/dist-packages/graphql/execution/executor.py", line 383, in complete_value
raise GraphQLLocatedError(field_asts, original_error=result)
graphql.error.located_error.GraphQLLocatedError: resolve_hello() missing 2 required positional arguments: 'context' and 'info'
None
请帮我解决问题。
你在这里没有提供太多信息,也许触发错误的代码会有所帮助,但谷歌搜索我发现了一些相关帖子
https://github.com/graphql-python/graphene/issues/601
https://github.com/graphql-python/graphene-django/issues/282
也许检查一下您在第一个提到的版本中使用的版本 link
graphQL 文档似乎已过时。 Graphene-python 2 更改了方法签名。试试这样的方法
def resolve_hello(self, info, **kwargs):
return 'Hello world!'