3

I am getting following error when using latest ariadne 0.16.1 with graphql-core 3.2.3 and Python 3.10. It's a FastAPI app.

from fastapi import FastAPI from ariadne.asgi import GraphQL

Second line throws the error

from graphql.type import GraphQLEnumType, GraphQLNamedType, GraphQLSchema ModuleNotFoundError: No module named 'graphql.type'

I tried changing libraries versions both upgrading and downgrading but no luck.

Thanks

UPDATE

issue is resolved. There was a graphql directory in the project. renaming it fixed the issue. Thanks.

2
  • The documentation suggests is should just be from graphql import..., without the .type. Commented Oct 7, 2022 at 6:47
  • @TimRoberts error is thrown from the ariadne package..I have not imported it explicitly in my code.
    – N.Moudgil
    Commented Oct 7, 2022 at 6:49

1 Answer 1

0

If the code is in a graphql/ directory then Python is confused about the modules and tries to find graphql/types.py in your directory instead of the package one.

If that's the case then rename your graphql/ directory to something else, e.g. graphql_api/.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.