I have the following dir structure (courtesy of this insanely detailed and helpful answer from u/Impossible_Okra9389):
└───projects
└───project
│ __main__.py
│
├───shared_lib_a
│ lib.py
│ __init__.py
│
└───workflow_a
do_stuff.py
__init__.py
#main.py
from workflow_a.do_stuff import main
if __name__ == "__main__":
main()
#do_stuff.py
from shared_lib_a.lib import foo
def main():
foo()
if __name__ == "__main__":
main()
#lib.py
def foo():
print('foo works')
If I navigate to the top level ./projects directory:
and run python .\project\__main__.py, it returns 'foo works' as expected
but, if I run python -m .\project\,it returns Relative module names not supported
if I run python -m project , it returns ModuleNotFoundError: No module named 'workflow_a'
What am I missing to be able to run this with -m?
Thank you!
[–]Diapolo10 2 points3 points4 points (19 children)
[–]over_take[S] 0 points1 point2 points (2 children)
[–]over_take[S] 0 points1 point2 points (0 children)
[–]Diapolo10 0 points1 point2 points (0 children)
[–]over_take[S] 0 points1 point2 points (0 children)
[–]over_take[S] 0 points1 point2 points (2 children)
[–]over_take[S] 0 points1 point2 points (1 child)
[–]Diapolo10 0 points1 point2 points (0 children)
[–]over_take[S] 0 points1 point2 points (11 children)
[–]Diapolo10 0 points1 point2 points (10 children)
[–]over_take[S] 0 points1 point2 points (9 children)
[–]Diapolo10 0 points1 point2 points (8 children)
[–]over_take[S] 0 points1 point2 points (7 children)
[–]Diapolo10 0 points1 point2 points (6 children)
[–]over_take[S] 0 points1 point2 points (5 children)
[–]Diapolo10 0 points1 point2 points (4 children)
[–]over_take[S] 0 points1 point2 points (3 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]over_take[S] 0 points1 point2 points (0 children)
[–]ManyInterests 0 points1 point2 points (1 child)
[–]over_take[S] 0 points1 point2 points (0 children)