[Python-bugs-list] [ python-Bugs-406280 ] Python 2.1b1 - pydoc shows nothing

noreply@sourceforge.net noreply@sourceforge.net
Sun, 08 Apr 2001 22:10:35 -0700


Bugs item #406280, was updated on 2001-03-06 05:06
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=406280&group_id=5470

Category: Python Library
Group: None
Status: Open
Priority: 3
Submitted By: Paul Moore (pmoore)
>Assigned to: Ka-Ping Yee (ping)
Summary: Python 2.1b1 - pydoc shows nothing

Initial Comment:
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...

----------------------------------------------------------------------

>Comment By: Tim Peters (tim_one)
Date: 2001-04-08 22:10

Message:
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

----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2001-03-16 20:30

Message:
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.

----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2001-03-11 16:27

Message:
Logged In: YES 
user_id=6380

Assigned to Tim, because of that fine combination of
keywords:
popen and Windows.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=406280&group_id=5470