Skip to content

ImportError: cannot import name GraphQLEnumValue #167

Closed
@cmacrander

Description

@cmacrander

To reproduce:

  1. With python 2.7, create a new virtual environment.
  2. pip install graphql-core
  3. Create a file, main.py with the line from graphql import GraphQLEnumValue
  4. Run the file, see error ImportError: cannot import name GraphQLEnumValue

I was attempting this because comments in the library show examples like this one. Note the references to GraphQLEnumValue.

class GraphQLEnumType(GraphQLType):
    """Enum Type Definition

    Some leaf values of requests and input values are Enums. GraphQL serializes Enum values as strings,
    however internally Enums can be represented by any kind of type, often integers.

    Example:

        RGBType = GraphQLEnumType(
            name='RGB',
            values=OrderedDict([
                ('RED', GraphQLEnumValue(0)),
                ('GREEN', GraphQLEnumValue(1)),
                ('BLUE', GraphQLEnumValue(2))
            ])
        )

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