graphql-python / graphql-python/flask-graphql

Error when importing flask_graphql

未關閉
#92 2 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Python
星號
1.3k
分支
139
PR 合併指標
30 天內沒有已合併 PR

描述

Unable to import this library into my project. I always get an ImportError even if I create a new project with only one import.

**My code api.py**

```python
from http.client import HTTPException
from multiprocessing import AuthenticationError
import os
from flask import Flask, request, jsonify, abort
from sqlalchemy import exc
import json
from flask_cors import CORS
from graphene import ObjectType, String, Schema
from flask_graphql import GraphQLView

app = Flask(__name__)
```

**My requirements.txt**
In the beginning, I specify the version of each library, but there was an error. To solve the error, I removed the FLask-GraphQL because it is in conflict with other graphene dependency. As it said, _could not import flask_graphql_ I remove graphene version and specify the last version in the Flask-GraphQL so that my project use the last version of this library and solve the dependency conflict with graphene. But always the same error.

```python
Flask == 2.2.2
Flask-SQLAlchemy == 3.0.2
Jinja2 == 3.1.2
pylint == 2.15.9
Flask-Cors == 3.0.10
graphene #For graphql python support
Flask-GraphQL == 2.0.1
```

**Error message**

```python
Error: While importing 'src.api', an ImportError was raised:

Traceback (most recent call last):
File "/home/sticlab/Documents/NotebookProject/rasa-car-location-services/backend/venv/lib/python3.10/site-packages/flask/cli.py", line 218, in locate_app
__import__(module_name)
File "/home/sticlab/Documents/NotebookProject/rasa-car-location-services/backend/src/api.py", line 9, in
from flask_graphql import GraphQLView
File "/home/sticlab/Documents/NotebookProject/rasa-car-location-services/backend/venv/lib/python3.10/site-packages/flask_graphql/__init__.py", line 1, in
from .blueprint import GraphQL
File "/home/sticlab/Documents/NotebookProject/rasa-car-location-services/backend/venv/lib/python3.10/site-packages/flask_graphql/blueprint.py", line 5, in
from .graphqlview import GraphQLView
File "/home/sticlab/Documents/NotebookProject/rasa-car-location-services/backend/venv/lib/python3.10/site-packages/flask_graphql/graphqlview.py", line 7, in
from graphql_server import (HttpQueryError, default_format_error,
File "/home/sticlab/Documents/NotebookProject/rasa-car-location-services/backend/venv/lib/python3.10/site-packages/graphql_server/__init__.py", line 2, in
from collections import namedtuple, MutableMapping
ImportError: cannot import name 'MutableMapping' from 'collections' (/usr/lib/python3.10/collections/__init__.py)
```

貢獻指南

這個儲存庫沒有索引到貢獻指南

研究方向

先在 Python 3.10 下使用 requirements.txt 中的版本重現匯入。檢查 traceback 中提到的 flask_graphql/__init__.py、blueprint.py、graphqlview.py 與 graphql_server/__init__.py 路徑;當報告的匯入在沒有 MutableMapping 錯誤的情況下成功,且相關的測試或應用程式啟動路徑通過時,即視為完成。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
flask, graphql, python
領域
api, backend
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
需要釐清
新手友好度
25/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。