PYTHONDOCS

Peter Otten __peter__ at web.de
Mon Jan 2 12:59:25 EST 2006


J. D. Leach wrote:

> found online. However, neither of my Python installations (2.4
> in /usr/bin/, and 2.4.2 in /usr/local/bin/) recognize the existence of the
> html docs. The following error from within the Python shell yields the
> same result:

> Then when I enter the os.environ.get('PYTHONDOCS') method, the following
> is produced:
> 
>>>> os.environ.get('PYTHONDOCS')
> '/usr/share/doc/python-2.4/html'
>>>> help('if')
> 
> ...Sorry, topic and keyword blah, blah, blah. No inline info
> available...blah, blah, bite me dolt...
> 
> I'm lost. Surely I've missed something simple.
> Thank you for your time and sorry about the long post. I just wanted to
> document in detail what is going on.
> 
> J. D. Leach

What do you get if you do

>>> import pydoc
>>> pydoc.help.docdir
'/should/be/path/to/docs'

I believe there is a bug in the documentation-finding code. With the current
logic PYTHONDOCS will only be honoured if none of the following directories
exist:

$PYTHONHOME/lib
(sys.executable)/doc/lib
/usr/doc/python-docs-2.4.2/lib
/usr/doc/python-2.4.2/lib
/usr/doc/python-docs-2.4/lib
/usr/doc/python-2.4/lib
(sys.prefix)/Resources/English.lproj/Documentation/lib

I think (untested) the proper fix would be an extra break

--- pydoc.py    2006-01-02 18:54:04.870404232 +0100
+++ pydoc1.py   2006-01-02 18:54:30.440516984 +0100
@@ -1635,6 +1635,7 @@
                     os.path.join(sys.prefix,
'Resources/English.lproj/Documentation')]:
             if dir and os.path.isdir(os.path.join(dir, 'lib')):
                 self.docdir = dir
+                break

     def __repr__(self):
         if inspect.stack()[1][3] == '?':

Consider filing a bug report.

Peter




More information about the Python-list mailing list