-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
-m option to run a module as a script #40956
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
Comments
Implements the '-m' option recently discussed on Runs a module 'as if' it had been invoked from the E.g., for a build directory, the following two commands Note that neither of these does the same thing as Given the vagaries of sys.path, this is quite handy - The current implementation makes changes to main.c Current limitations / to-do if this is pursued:
|
Logged In: YES New version of patch attached (run_module_2.diff). This version allows modules within packages to be executed. It's also a little more responsive when it comes to error The FindModule method is now marked as private (i.e. with The limit on file paths in pythonrun.c is now taken from The only bug I know of is that it misbehaves if you supply a |
Logged In: YES Barry, kicking this in your direction solely because you |
Logged In: YES New version (run_module_3.diff) Takes more account of the file description reported by Behaves correctly when a non-package is encountered while I also realised that the '-m' option doesn't currently |
Logged In: YES New version (#4) Trivial fix - tell PyRun_SimpleFile to close the file when |
Logged In: YES Relevant documentation locations that I can find: Python/C API section 2 (The Very High Level Layer) What's New sections 12 & 13 |
Logged In: YES 5th version of patch attached
|
Logged In: YES Doc patch attached. Take it with a grain of salt, since this This doesn't cover anything for 'What's New' - that can wait |
Logged In: YES Raymond, Passing to you to see what you think of the code, rather Guido settled for not vetoing it, but the discussion with Extension to allow packages and zip imports can wait until |
Logged In: YES Armin, do you have time for this one. I'm buried for a few |
Logged In: YES Sorry, I didn't follow any of this discussion, neither here |
Logged In: YES The patch does not compile on windows. AFAICT, importdl.h Wish I had time to help you on this one, but I don't. |
Logged In: YES New version attached which should fix the Windows compile Unfortunately, I won't get access to a Windows build machine |
Logged In: YES Put the test directory in PYTHONPATH and run the following
|
Logged In: YES Nice catch. . . I figured out what the problem is - regrtest.py uses Obviously, that is going to have to change. Either |
Logged In: YES New version (7) attached which does the right thing for This one sets argv[0] correctly, but was initially a little Examples of the error handling in this version: [...@localhost src]$ ./python -m foo (/home/.../dev/python/dist/src/build/lib.linux-i686-2.4/parser.so) |
Logged In: YES New version of doc patch which changes the tutorial only |
Logged In: YES Please put in a single, combined documentation patch. Be sure to spell-check and run: python -m texcheck tut.tex |
Logged In: YES texcheck complains about the Unicode in the tutorial even on I'm not sure what, if anything, I need to do for "what's |
Logged In: YES Accepted and applied. Checking in Doc/tut/tut.tex; |
Logged In: YES Regarding support for packages, here's a use case: python -m pychecker.checker mymodule.py (plus my own tools which live inside packages) |
Logged In: YES I've opened a new tracker item to cover enhancement to |
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: