swagger-api / swagger-codegen

swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition.
http://swagger.io
Apache License 2.0
16.94k stars 6.03k forks source link

ImportError - Swagger codegen for flask #6310

Open ctippur opened 7 years ago

ctippur commented 7 years ago
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 │   │   │   ├── basemodel.cpython-36.pyc │   │   │   ├── binary.cpython-36.pyc │   │   │   └── body.cpython-36.pyc │   │   ├── basemodel.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?

ctippur commented 7 years ago

I am using python 3.62 on a mac.

ctippur commented 7 years ago

I believe this maybe similar to https://github.com/swagger-api/swagger-codegen/issues/4789