[Python-bugs-list] [ python-Bugs-407300 ] Win32: pydoc command isn't executable

noreply@sourceforge.net noreply@sourceforge.net
Fri, 16 Mar 2001 20:36:11 -0800


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

Category: Windows
Group: Platform-specific
Status: Open
Priority: 5
Submitted By: Paul Moore (pmoore)
Assigned to: Tim Peters (tim_one)
Summary: Win32: pydoc command isn't executable

Initial Comment:
The Python 2.1b1 binary installer for Windows supplies 
a small "pydoc" script in the main Python executable 
directory. However, this script is Unix-specific and 
does not work on Windows.

Suggestion: for Windows, include a trivial pydoc.bat 
file to start pydoc. The following one-liner works:

--- pydoc.bat ---
@python -c "import pydoc; pydoc.cli()" %*
-----------------

The only problem with this version is that it uses the 
version of python.exe found on PATH, rather than the 
version in the directory containing pydoc.bat. 
However, as the Unix script has the same issue, this 
can be viewed as a "feature"...

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

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

Message:
Logged In: YES 
user_id=31435

This isn't a priority for me.  pydoc in the root directory 
is actually AMK's Tools/scripts/pydoc (in the CVS tree).  
Guido fiddled the Windows installer to install that file 
into the root directory instead of into Tools/scripts, and 
just so that the "Module Docs" program group entry had 
something to execute.  It works fine for what it was 
designed for.

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

Comment By: Paul Moore (pmoore)
Date: 2001-03-13 01:59

Message:
Logged In: YES 
user_id=113328

Using a pyw file doesn't work, as that stops the usage
   pydoc <module>
which should display documentation in the console window.

Also, .py[w] files aren't executable without an extension. 
For example, you'd have to type pydoc.pyw, not just pydoc.

Instead of %*, use %1 %2 %3 %4 %5 %6 %7 %8 %9. And to avoid 
python.exe if there are no args (when the Tk stuff is used) 
how about

@echo off
if "%1"=="" pythonw -c "import pydoc; pydoc.cli()"
if NOT "%1"=="" python -c "import pydoc; pydoc.cli()" %1 %2 
%3 %4 %5 %6 %7 %8 %9

That should work on 9x and NT/2000. I repeat the test for 
simplicity. You could use GOTO and labels, instead...


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

Comment By: Tim Peters (tim_one)
Date: 2001-03-10 23:42

Message:
Logged In: YES 
user_id=31435

"%*" doesn't work under Win9X.

Changed the installer to name the file pydoc.pyw instead.

Note that the Windows installer also creates an entry for 
pydoc under Start -> Programs -> Python -> Module Docs.

Note too that due to Tk problems, we can't encourage using 
python instead of pythonw to run pydoc (Tk apps have an 
unfortunate tendency to wedge Windows when run via python; 
see other SF bugs for more on that).

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

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