[New-bugs-announce] [issue6816] Provide CPython command line functionality via runpy module

Nick Coghlan report at bugs.python.org
Tue Sep 1 12:56:39 CEST 2009


New submission from Nick Coghlan <ncoghlan at 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 <report at bugs.python.org>
<http://bugs.python.org/issue6816>
_______________________________________


More information about the New-bugs-announce mailing list