Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG][Python] ModuleNotFoundError when packagename contains dots #2991

Closed
5 of 6 tasks
saigiridhar21 opened this issue May 24, 2019 · 0 comments
Closed
5 of 6 tasks

Comments

@saigiridhar21
Copy link
Contributor

saigiridhar21 commented May 24, 2019

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

If we have dots in the packagename (e.g., openapi.client), then required directory structure is getting created like openapi/client. Inside openapi/client/, we will have api and models directories. But, __init__.py files are missing from those sub directories(at openapi and client level). So, the users of this built package will face ModuleNotFoundError: No module named 'openapi' error.

openapi-generator version

4.0.0

OpenAPI declaration file content or url
Command line used for generation

java -jar openapi-generator-cli.jar generate --generator-name python --input-spec openapi-schema.json --output openapi.client --additional-properties packagename=openapi.client

Steps to reproduce
  • Generate the SDK using a package name that contains dots e.g., openapi.client.
  • Then, build and install the SDK.
  • Try to import it in a separate project as a client/user of SDK and run some example code.
  • Then, an error will thrown like ModuleNotFoundError: No module named 'openapi'
Related issues/PRs
Suggest a fix

If the packagename contain dots, add __init__.py files at each sub directory level.

@saigiridhar21 saigiridhar21 changed the title [BUG][Python] ModuleNotFoundError when package names contains dots [BUG][Python] ModuleNotFoundError when packagename contains dots May 24, 2019
@wing328 wing328 closed this as completed May 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants