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: Win32: pydoc command isn't executable
Type: Stage:
Components: Windows Versions:
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: tim.peters Nosy List: paul.moore, tim.peters
Priority: normal Keywords:

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

Messages (5)
msg3796 - (view) Author: Paul Moore (paul.moore) * (Python committer) Date: 2001-03-09 13:45
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"...
msg3797 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2001-03-11 07:42
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).
msg3798 - (view) Author: Paul Moore (paul.moore) * (Python committer) Date: 2001-03-13 09:59
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...
msg3799 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2001-03-17 04:36
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.
msg3800 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2001-04-02 20:02
Logged In: YES 
user_id=31435

Closing again -- AMK's pydoc is no longer copied to the 
install directory (and probably should not have been to 
begin with ...).
History
Date User Action Args
2022-04-10 16:03:50adminsetgithub: 34124
2001-03-09 13:45:56paul.moorecreate