graphql-python / graphql-python/graphene

AttributeError: partially initialized module 'graphene' has no attribute 'ObjectType' (most likely due to a circular import)

Ouverte
#1,373 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub
🐛 bug
Langage dominant
Python
Étoiles
8.2k
Forks
818
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

**Note: for support questions, please use stackoverflow**. This repository's issues are reserved for feature requests and bug reports.

* **What is the current behavior?**

```
File "/Users/noj/recurrency/legacy-api/v4/graphql.py", line 1, in
import graphene
File "/opt/homebrew/lib/python3.9/site-packages/graphene/__init__.py", line 3, in
from .types import (
File "/opt/homebrew/lib/python3.9/site-packages/graphene/types/__init__.py", line 2, in
from graphql import ResolveInfo
File "/Users/noj/recurrency/legacy-api/v4/graphql.py", line 3, in
class Query(graphene.ObjectType):
AttributeError: partially initialized module 'graphene' has no attribute 'ObjectType' (most likely due to a circular import)
```

* **If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem** via
a github repo, https://repl.it or similar.

```
import graphene

class Query(graphene.ObjectType):
hello = graphene.String(description='A typical hello world')

def resolve_hello(self, info):
return 'World'

schema = graphene.Schema(query=Query)

if __name__ == "__main__":
query = '''
query SayHello {
hello
}
'''
result = schema.execute(query)

print (result)

```

* **What is the expected behavior?**

No errors.

* **Please tell us about your environment:**

- Version: Python 3.9.7
- Platform: Mac

* **Other information** (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow)

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Piste de recherche

Commencez par le traceback et l’exemple Python minimal de l’issue, en prêtant attention au point d’entrée local v4/graphql.py et à la chaîne d’importation de graphene. Vérifiez si le comportement signalé peut être reproduit dans l’environnement Python 3.9.7 indiqué ; la tâche est terminée lorsqu’il est établi s’il s’agit d’un bug de Graphene ou d’un problème spécifique à la structure des modules de l’exemple.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
graphql, python
Domaine
api, backend
Type d'issue
Bug
Difficulté
2/5
Temps estimé
1-3 heures
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
25/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.