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

Python init template (app) gets class name wrong #2183

Closed
garnaat opened this issue Apr 4, 2019 · 3 comments
Closed

Python init template (app) gets class name wrong #2183

garnaat opened this issue Apr 4, 2019 · 3 comments
Assignees
Labels
bug This issue is a bug. language/python Related to Python bindings p0

Comments

@garnaat
Copy link
Contributor

garnaat commented Apr 4, 2019

If you do:

$ mkdir pythonhw
$ cd pythonhw
$ cdk init --language python

The class name used in the import statement in app.py is not properly templatized and does not match the name of the class in the package directory file. This causes an error like this:

(.env) $ cdk synth
Traceback (most recent call last):
  File "app.py", line 5, in <module>
    from pythonhw.pythonhw_stack import PyStack
ImportError: cannot import name 'PyStack' from 'pythonhw.pythonhw_stack' (/Users/garnaat/projects/cdkdev/pythonhw/pythonhw/pythonhw_stack.py)
Subprocess exited with error 1
@garnaat garnaat added bug This issue is a bug. language/python Related to Python bindings labels Apr 4, 2019
@garnaat garnaat self-assigned this Apr 4, 2019
@imajinos
Copy link

imajinos commented Apr 4, 2019

errata. "cdk init app --language=python"

@eladb
Copy link
Contributor

eladb commented Apr 4, 2019

Another issue I ran into is that if your project directory has a hyphen, the generated python module will be invalid.

@garnaat
Copy link
Contributor Author

garnaat commented Apr 4, 2019

Yep. See #2180.

@fulghum fulghum added the p0 label Apr 4, 2019
garnaat pushed a commit to garnaat/aws-cdk that referenced this issue Apr 5, 2019
garnaat added a commit that referenced this issue Apr 7, 2019
* Fixing issues #2180 and #2183 related to Python init templates

* Add some instructions for manually creating a virtualenv
@fulghum fulghum closed this as completed Apr 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. language/python Related to Python bindings p0
Projects
None yet
Development

No branches or pull requests

4 participants