swagger-api / swagger-api/swagger-codegen
ImportError - Swagger codegen for flask
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
I am getting the following error when running flask server:
from .binary import Binary
File "/Users/ctippur/cyclops/cyclopscloud/flaskapi/cyclopsflaskglobal/python-flask-server/swagger_server/models/binary.py", line 4, in
from swagger_server.models.binary import Binary
Here is the tree for swagger server that got generated via swagger UI (http://editor.swagger.io)
├── Dockerfile
├── README.md
├── git_push.sh
├── requirements.txt
├── setup.py
├── swagger_server
│ ├── init.py
│ ├── main.py
│ ├── pycache
│ │ ├── init.cpython-36.pyc
│ │ ├── main.cpython-36.pyc
│ │ ├── encoder.cpython-36.pyc
│ │ └── util.cpython-36.pyc
│ ├── controllers
│ │ ├── init.py
│ │ └── default_controller.py
│ ├── encoder.py
│ ├── models
│ │ ├── init.py
│ │ ├── pycache
│ │ │ ├── init.cpython-36.pyc
│ │ │ ├── base_model_.cpython-36.pyc
│ │ │ ├── binary.cpython-36.pyc
│ │ │ └── body.cpython-36.pyc
│ │ ├── base_model_.py
│ │ ├── binary.py
Swagger-codegen version
I generated server code via http://editor.swagger.io
Swagger declaration file content or ur
Command line used for generation
N/A
Steps to reproduce
python3 -m venv flaskglobal
source flaskglobal/bin/activate
cp binary to flaskglobal and unzip contents
cd python-flask-server
pip install -r requirements.txt
python -m swagger_server
Could this be a pythonpath issue?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the failure with python -m swagger_server after installing requirements.txt. Inspect swagger_server/models/binary.py, swagger_server/models/__init__.py, and the generated package tree to trace the self-referential import of Binary. Done means the generated Flask server starts without this ImportError, with a focused regression test or reproducible validation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- flask, python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100