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

fix(python): module import fails: NameError: name 'List' is not defined #2851

Merged
merged 2 commits into from
May 26, 2021

Conversation

polothy
Copy link
Contributor

@polothy polothy commented May 20, 2021

When importing a module in Python, you can get this error:

NameError: name 'List' is not defined

JSII generated code:

import abc
import builtins
import datetime
import enum
import typing

import jsii
import publication
import typing_extensions

from ._jsii import *

__all__: List[typing.Any] = []  # <--- HERE IS THE BUG

publication.publish()

Just need to prefix List with typing.

Related issue/pr:


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@polothy
Copy link
Contributor Author

polothy commented May 20, 2021

Note: I manually edited everything, so assuming the PR builds will verify everything 🤞

@RomainMuller
Copy link
Contributor

@all-contributors add @polothy for code

@allcontributors
Copy link
Contributor

@RomainMuller

I've put up a pull request to add @polothy! 🎉

@mergify
Copy link
Contributor

mergify bot commented May 26, 2021

Thank you for contributing! ❤️ I will now look into making sure the PR is up-to-date, then proceed to try and merge it!

@mergify mergify bot added the pr/ready-to-merge This PR is ready to be merged. label May 26, 2021
@mergify
Copy link
Contributor

mergify bot commented May 26, 2021

Merging (with squash)...

1 similar comment
@mergify
Copy link
Contributor

mergify bot commented May 26, 2021

Merging (with squash)...

@mergify mergify bot merged commit b7b9e5f into aws:main May 26, 2021
@mergify mergify bot removed the pr/ready-to-merge This PR is ready to be merged. label May 26, 2021
@polothy polothy deleted the fix-python branch May 26, 2021 17:00
@polothy
Copy link
Contributor Author

polothy commented May 26, 2021

Yah, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants