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: Pydoc sets choices for doc locations incorrectly
Type: Stage:
Components: Library (Lib) Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: georg.brandl, skip.montanaro
Priority: normal Keywords:

Created on 2007-01-05 16:24 by skip.montanaro, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg30923 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2007-01-05 16:24
In pydoc.Helper.__init__ I see this code:

        execdir = os.path.dirname(sys.executable)
        homedir = os.environ.get('PYTHONHOME')
        for dir in [os.environ.get('PYTHONDOCS'),
                    homedir and os.path.join(homedir, 'doc'),
                    os.path.join(execdir, 'doc'),
                    '/usr/doc/python-docs-' + split(sys.version)[0],
                    '/usr/doc/python-' + split(sys.version)[0],
                    '/usr/doc/python-docs-' + sys.version[:3],
                    '/usr/doc/python-' + sys.version[:3],
                    os.path.join(sys.prefix, 'Resources/English.lproj/Documenta$            if dir and os.path.isdir(os.path.join(dir, 'lib')):
                self.docdir = dir

I think the third choice in the list of candidate directories is wrong.  execdir is the directory of the Python executable (e.g., it's /usr/local/bin by default).  I think it should be set as

    execdir = os.path.dirname(os.path.dirname(sys.executable))

You're not going to find a "doc" directory in /usr/local/bin.
msg30924 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2007-03-01 10:25
Looks like that is for Windows distributions, as there is C:\Python24\python.exe and C:\Python24\Doc.
msg30925 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2007-03-02 14:37
Added some more search paths in rev. 54080.
History
Date User Action Args
2022-04-11 14:56:21adminsetgithub: 44414
2007-01-05 16:24:59skip.montanarocreate