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
Enhancing '-m' to support packages (PEP 338) #40995
Comments
Thomas Heller posted "python -m pychecker.checker The only semantics that I can see working for packages python -m pychecker.checker is equivalent to: python execchecker.py where execchecker.py is: import sys, imp
import pychecker
info = imp.find_module("checker", pychecker.__path__)
sys.argv[0] = info[1]
execfile(info[0]) We *have* to do the import of the requested script's I will attach two versions. The first will, when it fails to find a module for The second version will be pure C. The reason I'm going |
Logged In: YES execmodule.py attached. You can experiment using "python -m execmodule <script>", "from execmodule import execmodule" also has intriguing |
Logged In: YES run_package_Py.diff attached, and a new version of execmodule.py If it fails to find the module requested with '-m', it One obscure issue is that a command line like "python This may interact oddly with anyone using Py_GetArgcArgv to One possibility is to just leave junk in sys.argv[0] when I'm out of time for today, so I doubt I'll be able to get to |
Logged In: YES This should be taken back to python-dev. Guido had strong Also, it's a little late in the game. The beta is due out on The mention of "intriguing possibilities" will likely not help |
Logged In: YES I agreee with Raymond - bumping the group to Python 2.5. I'll put execmodule.py in the cookbook as a useful 2.4 At the moment, making this part of the standard library The intriguing possibilities of execmodule are simply that |
Logged In: YES execmodule has been posted to the cookbook: I've also updated the attached version of execmodule.py to |
Logged In: YES I've put a PEP together for adding this in 2.5 - a draft was Two points from the PEP draft:
The draft can be found here: |
Logged In: YES The PEP now has a number (PEP-338) which I've added to the I've also attached an updated patch which matches the Finally, I added a small archive with a simple package structure To try it out:
Then, "./python -m PEP-338.hi" and "./python -m |
Logged In: YES Closing this patch and submitting a new one after major |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: