On Sat, Jan 11, 2020 at 02:46:14PM -0300, Soni L. wrote: > I just want python foo/bar/baz/qux/__main__.py but with imports that > actually work. -m works, but requires you to cd. -m with path would be > an more than huge improvement.
That's what you said in your first post. In my first response, I said it works for me. Unless I have misunderstood you, I think you are mistaken about needing to cd into the package root. Can you give a clear (and simple) example of a package in the PYTHONPATH where python -m package.module doesn't work? > and it absolutely should look for the given module in the given path. > not "anywhere in the PYTHONPATH". If you know the precise location of the module, and you don't want to search the PYTHONPATH, why are you using -m? `python -m module` is for searching the PYTHONPATH when you don't know or care precisely where module is located. Think of it as a hammer. `python filename` is for running the module when you do know and care precisely which file you are running. Think of it as a screwdriver. You seem to be asking to weld a screwdriver head to a hammer so that you can have the hammer behave like a screwdriver. If you know the precise path you want to run, why are you using # your proposed syntax python -m spam/eggs/cheese.aardvark when you could just as easily run this and get the effect you want? python spam/eggs/cheese/aardvark.py This is not a rhetorical question. As far as I can tell from your explanation so far, what you want to do is possible *right now* if you just stop typing `-m` after the `python` command and use the right tool for the job. If you see a difference that I don't, please explain what that difference is. -- Steven _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/TVPAM6OFRS4O43SW66UNRODNBVWPBIBE/ Code of Conduct: http://python.org/psf/codeofconduct/