swagger-api / swagger-api/swagger-codegen
ImportError: No module named 'swagger_client.api.default_api'
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
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'
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
Reproduce the generation command with swagger-codegen-cli.jar 2.3.1 and inspect the generated swagger_client package, especially api/init.py and the import in swagger_client/init.py. Compare the generated files with test.py's DefaultApi import; done means the generated client installs and importing swagger_client.DefaultApi no longer raises ImportError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, python
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100