Swagger-codegen: ImportError: No module named 'swagger_client.api.default_api'

Created on 15 Feb 2018  路  1Comment  路  Source: swagger-api/swagger-codegen

Description

Trying to generate a Python client library,

Swagger-codegen version

swagger-codegen-cli.jar 2.3.1

Steps to reproduce

java -jar swagger-codegen-cli generate -i /home/my_name/PycharmProjects/api/api.json -l python -o /home/my_name/test_api

Upload a result to Bitbacket git repository
Install module

test.py
`
import swagger_client

a = swagger_client.DefaultApi()
`
has error

File "/usr/local/lib/python3.5/dist-packages/swagger_client/__init__.py", line 19, in
from swagger_client.api.default_api import DefaultApi
File "/usr/local/lib/python3.5/dist-packages/swagger_client/api/__init__.py", line 6, in
from swagger_client.api.default_api import DefaultApi
ImportError: No module named 'swagger_client.api.default_api'

Most helpful comment

I have the same issue after generating a Python client library with the docker image of swagger-codegen-cli swaggerapi/swagger-codegen-cli.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/swagger_client/__init__.py", line 19, in <module>
    from swagger_client.api.datastreams_api import DatastreamsApi
  File "/usr/local/lib/python2.7/dist-packages/swagger_client/api/__init__.py", line 6, in <module>
    from swagger_client.api.datastreams_api import DatastreamsApi
  File "/usr/local/lib/python2.7/dist-packages/swagger_client/api/datastreams_api.py", line 21, in <module>
    from swagger_client.api_client import ApiClient
  File "/usr/local/lib/python2.7/dist-packages/swagger_client/api_client.py", line 27, in <module>
    import swagger_client.models
  File "/usr/local/lib/python2.7/dist-packages/swagger_client/models/__init__.py", line 28, in <module>
    from swagger_client.models.parameter import Parameter
  File "/usr/local/lib/python2.7/dist-packages/swagger_client/models/parameter.py", line 19, in <module>
    from swagger_client.models.errorunknown import ERRORUNKNOWN  # noqa: F401,E501
ImportError: No module named errorunknown

Is the issue probably fixed with #7684?

>All comments

I have the same issue after generating a Python client library with the docker image of swagger-codegen-cli swaggerapi/swagger-codegen-cli.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/swagger_client/__init__.py", line 19, in <module>
    from swagger_client.api.datastreams_api import DatastreamsApi
  File "/usr/local/lib/python2.7/dist-packages/swagger_client/api/__init__.py", line 6, in <module>
    from swagger_client.api.datastreams_api import DatastreamsApi
  File "/usr/local/lib/python2.7/dist-packages/swagger_client/api/datastreams_api.py", line 21, in <module>
    from swagger_client.api_client import ApiClient
  File "/usr/local/lib/python2.7/dist-packages/swagger_client/api_client.py", line 27, in <module>
    import swagger_client.models
  File "/usr/local/lib/python2.7/dist-packages/swagger_client/models/__init__.py", line 28, in <module>
    from swagger_client.models.parameter import Parameter
  File "/usr/local/lib/python2.7/dist-packages/swagger_client/models/parameter.py", line 19, in <module>
    from swagger_client.models.errorunknown import ERRORUNKNOWN  # noqa: F401,E501
ImportError: No module named errorunknown

Is the issue probably fixed with #7684?

Was this page helpful?
0 / 5 - 0 ratings