graphql-python / graphql-python/graphene

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

オープン
#1,373 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
🐛 bug
主要言語
Python
スター
8.2k
フォーク
818
PR マージ指標
30日以内にマージされた PR はありません

説明

**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)

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

issue 内の traceback と最小限の Python 例から始め、ローカルの v4/graphql.py エントリーポイントと graphene のインポートチェーンに注意してください。報告された動作を、記載された Python 3.9.7 環境で再現できるか確認してください。完了とは、これが Graphene のバグなのか、例のモジュール構成に固有の問題なのかを特定することです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
graphql, python
領域
api, backend
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。