New submission from Nick Coghlan <ncogh...@gmail.com>: Currently, the runpy._run_module_as_main() function allows a launch script to mimic Python's -m switch fairly well.
This RFE suggests making it possible to mimic other command line behaviour of the CPython interpreter in a documented fashion: run_module_as_main - document and make public the existing _run_module_as_main function (exposes -m style functionality) run_path_as_main - accept a filesystem path and execute it as per the command line rules for executing named scripts, zipfiles and directories (exposes normal script execution functionality) run_file_as_main - accept a file-like object and execute it as per the command line rules for executing stdin (exposes '-' style functionality) run_code_as_main - accept a string or code object and execute it (exposes -c style functionality) The runpy module would also be updated to expose these via its command line to ensure they achieve their stated goal of allowing a launch script to mimic the native interpreter behaviour. Due to the legacy of implementing -m style execution by default, the module command line will expose filesystem path execution through a '-f' switch. ---------- messages: 92140 nosy: ncoghlan severity: normal status: open title: Provide CPython command line functionality via runpy module type: feature request _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue6816> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com