Reputation: 1409
Here in VSCode whenever I write the following line from . import dispatcher
pylint always gives error statement saying Attempted relative import beyond top-level package.
But when I run the module using this command: python -m src.train
the program runs without flashing any error. Here is the screenshot from the VSCode editor:
Does someone know who to solve this thing in VSCode?
Upvotes: 8
Views: 3011
Reputation: 101
Just add an empty __init__.py
file of the folder that contains your dispatcher.py
file, then all the .py
files under the folder, as whole, should be recognized as a package. And the lint error should dismiss.
Upvotes: 5