classification
Title: subprocess demo functions
Type: behavior Stage: resolved
Components: Versions: Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: rosslagerwall Nosy List: georg.brandl, gregory.p.smith, pitrou, python-dev, rosslagerwall
Priority: normal Keywords:

Created on 2011-03-27 07:27 by rosslagerwall, last changed 2011-03-27 15:36 by rosslagerwall. This issue is now closed.

Messages (5)
msg132291 - (view) Author: Ross Lagerwall (rosslagerwall) (Python committer) Date: 2011-03-27 07:27
Running subprocess as a module invokes some demo functions.

On posix, one of these doesn't work:

$ ./python -m subprocess
Process list:
b'  PID TTY          TIME CMD\n 9003 pts/6    00:00:00 python\n 9004 pts/6    00:00:00 ps\n23760 pts/6    00:00:00 bash\n'
Looking for 'hda'...
b''

Trying a weird file...
The file didn't exist.  I thought so...
Child traceback:
Traceback (most recent call last):
  File "/home/ross/code/py3kdev/silly/Lib/subprocess.py", line 1757, in _demo_posix
    print(Popen(["/this/path/does/not/exist"]).communicate())
  File "/home/ross/code/py3kdev/silly/Lib/subprocess.py", line 766, in __init__
    restore_signals, start_new_session)
  File "/home/ross/code/py3kdev/silly/Lib/subprocess.py", line 1439, in _execute_child
    raise child_exception_type(errno_num, err_msg)
OSError: [Errno 2] No such file or directory: '/this/path/does/not/exist'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ross/code/py3kdev/silly/Lib/runpy.py", line 160, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/home/ross/code/py3kdev/silly/Lib/runpy.py", line 73, in _run_code
    exec(code, run_globals)
  File "/home/ross/code/py3kdev/silly/Lib/subprocess.py", line 1790, in <module>
    _demo_posix()
  File "/home/ross/code/py3kdev/silly/Lib/subprocess.py", line 1762, in _demo_posix
    print(e.child_traceback)
AttributeError: 'OSError' object has no attribute 'child_traceback'


I think these demo functions should be either be removed or incorporated into the docs.
msg132323 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-03-27 14:06
> I think these demo functions should be either be removed or
> incorporated into the docs.

+1 for either of that.
msg132328 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2011-03-27 14:20
Yeah, +1.  I can't think of anything useful for "python -m subprocess" to do, so let's just get rid of the "demo"s.
msg132339 - (view) Author: Roundup Robot (python-dev) Date: 2011-03-27 15:35
New changeset cae30f34bd16 by Ross Lagerwall in branch 'default':
Issue #11692: Remove unnecessary demo functions in subprocess module.
http://hg.python.org/cpython/rev/cae30f34bd16
msg132341 - (view) Author: Ross Lagerwall (rosslagerwall) (Python committer) Date: 2011-03-27 15:36
OK, I simply removed the functions.
History
Date User Action Args
2011-03-27 15:36:35rosslagerwallsetstatus: open -> closed
messages: + msg132341

assignee: rosslagerwall
resolution: fixed
stage: resolved
2011-03-27 15:35:09python-devsetnosy: + python-dev
messages: + msg132339
2011-03-27 14:20:56georg.brandlsetnosy: + georg.brandl
messages: + msg132328
2011-03-27 14:06:40pitrousetnosy: + pitrou
messages: + msg132323
2011-03-27 07:27:49rosslagerwallcreate