classification
Title: pydoc.Helper.help() ignores input/output init parameters
Type: behavior Stage: test needed
Components: Library (Lib) Versions: Python 2.6
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: ajaksu2, tws5 (2)
Priority: normal Keywords easy

Created on 2004-04-22 20:11 by tws5, last changed 2009-04-22 17:16 by ajaksu2.

Messages (2)
msg60481 - (view) Author: Maxim Krikun (tws5) Date: 2004-04-22 20:11
The ourput of pydoc.Helper help() method is always sent
to sys.stdout, even if Helper was supplied with
different input/output streams at initialization. Other
methods: listtopics etc. work as expected.

Example:
########################

import sys, pydoc
from StringIO import StringIO

buf=StringIO()
H=pydoc.Helper(sys.stdin,buf)

H.listtopics()
H.help("pydoc")
#at this point help on pydoc is printed to stdout
H.listtopics()

ss=buf.getvalue()
print ss
#at this point the list of topics is printed twice

########################

sys.version:
 '2.3 (#46, Aug 11 2003, 09:34:05) [MSC v.1200 32 bit
(Intel)]'

The problem persists in pydoc.py version 1.90 from CVS.

The reason for such behaviour is a call to global (in
module scope) function doc() at line 1628 in pydoc.py 1.90.
which doesn't care about Helper.input Helper.output
settings.
msg82047 - (view) Author: Daniel Diniz (ajaksu2) Date: 2009-02-14 13:53
Confirmed. Is it relevant?
History
Date User Action Args
2009-04-22 17:16:39ajaksu2setkeywords: + easy
stage: test needed
2009-02-14 13:53:53ajaksu2settype: behavior
messages: + msg82047
nosy: + ajaksu2
versions: + Python 2.6, - Python 2.3
2004-04-22 20:11:10tws5create