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: relative imports from '' package are not allowed #894

Merged

Conversation

podtserkovskiy
Copy link
Contributor

Summary

When we resolve a relative import from root package "", we get the import prefixed by "."
However, this kind of imports are not allowed and cpython throws an error:

/Users/michaelpo/PycharmProjects/pythonProject/venv/bin/python /Users/michaelpo/PycharmProjects/pythonProject/main.py 
Traceback (most recent call last):
  File "/Users/michaelpo/PycharmProjects/pythonProject/main.py", line 2, in <module>
    from .l1 import l1_func
ImportError: attempted relative import with no known parent package

Process finished with exit code 1

Test Plan

Unit tests

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 14, 2023
@amyreese amyreese merged commit 497f778 into Instagram:main Mar 14, 2023
@amyreese
Copy link
Member

thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants