This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Python 2.1b1 - pydoc shows nothing
Type: Stage:
Components: Library (Lib) Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: ping Nosy List: gvanrossum, paul.moore, ping, tim.peters
Priority: low Keywords:

Created on 2001-03-06 13:06 by paul.moore, last changed 2022-04-10 16:03 by admin. This issue is now closed.

Messages (5)
msg3716 - (view) Author: Paul Moore (paul.moore) * (Python committer) Date: 2001-03-06 13:06
Platform: Windows 2000, Python 2.1b1

The pydoc script works fine in "serve documents to a 
browser" mode (python pydoc). Also, running it as a 
command line application, as "python pydoc pydoc", 
works fine when the environment variable PAGER is 
unset.

However, when I have PAGER=less, I get no output at 
all.

It looks like a bug in pydoc.pipepager(), which is the 
result of a bug in os.popen(). I can work around the 
bug by using pydoc.tempfilepager() in place of 
pydoc.pipepager(), but I don't know what the 
underlying popen() bug is.

To demonstrate the os.popen() bug, see the attached 
interactive session:

C:\Data>python21
Python 2.1b1 (#11, Mar  2 2001, 11:23:29) [MSC 32 bit 
(Intel)] on win32
Type "copyright", "credits" or "license" for more 
information.
>>> import os
>>> a = os.popen("more", "w")
>>> a.write("Hello")
>>> a.close()

Run this, and note that the "More" program never 
starts...
msg3717 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2001-03-12 00:27
Logged In: YES 
user_id=6380

Assigned to Tim, because of that fine combination of
keywords:
popen and Windows.
msg3718 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2001-03-17 04:30
Logged In: YES 
user_id=31435

Assigned to MarkH for popen insight.

"more" does start, but the output just vanishes under 
Win98SE (and, I assume, W2K too).  This I deduced via doing 
os.popen("more > somefile.txt", "w") instead; the file is 
created, and does contain the stuff written to the handle.  
Besides, the std test_popen2 test uses "more" under Windows 
too, and works fine.

Nothing unique about "more" here:  tried a number of .exe 
files, and it's all the same:  the stdout of the popen'ed 
program isn't displayed.  I assume this is because the 
original console's stdout doesn't manage to become the 
popen'ed stdout, but I don't understand it in detail.  Deep 
or shallow?

In any case, trying to implement a pager via popen like 
this goes beyond what C guarantees, so I reduced the 
priority accordingly.
msg3719 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2001-04-09 05:10
Logged In: YES 
user_id=31435

Reassigned to Ping since wrestling w/ popen() on Windows is 
hopeless.  Left the priority low because it's gotta be rare 
for anyone to define a PAGER envar under Windows.  Note 
that Paul mailed some kind of related patch to Python-Dev 
recently ... mumble, mumble, ... here:

http://mail.python.org/pipermail/python-dev/2001-
April/014070.html
msg3720 - (view) Author: Ka-Ping Yee (ping) * (Python committer) Date: 2001-04-13 12:48
Logged In: YES 
user_id=45338

Fixed by always using temp files in Windows.
New version is checked in.
History
Date User Action Args
2022-04-10 16:03:49adminsetgithub: 34075
2001-03-06 13:06:24paul.moorecreate