Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Error when importing flask_graphql

未关闭
#92 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
25/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
flask, graphql, python
领域
api, backend

调研方向

首先,在 Python 3.10 下使用 requirements.txt 中的版本复现导入。检查 traceback 中提到的 flask_graphql/init.py、blueprint.py、graphqlview.py 和 graphql_server/init.py 路径;当报告的导入在没有 MutableMapping 错误的情况下成功,并且相关的测试或应用程序启动路径通过时,即视为完成。

由索引模型根据 Issue 内容生成。

描述

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

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.

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

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 <module>
    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 <module>
    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 <module>
    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 <module>
    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 <module>
    from collections import namedtuple, MutableMapping
ImportError: cannot import name 'MutableMapping' from 'collections' (/usr/lib/python3.10/collections/__init__.py)
主要语言
Python
星标
1.3k
派生
139
PR 合并指标
30 天内没有已合并 PR

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

graphql-python/flask-graphql 的其他 Issue

查看 graphql-python/flask-graphql 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。