[Python-Dev] Help command

Paul Prescod paul@prescod.net
Sat, 15 Jul 2000 20:14:30 -0500


Okay, I wrote the help command today. The transcript before was just a
Microsoft-style "Technology Preview." I'm pretty happy with the extent
to which I can pull in HTML and get lots of content from Fred's HTML
distribution immediately. The only trick is finding out where the
documentation is. I know that Unix users have a variety of installation
patterns and I have no idea if this works at all on the Macintosh.
Please help!

Here's my current scheme:

if os.environ.has_key("PYTHONDOCS"):
    self.docdir=os.environ["PYTHONDOCS"]
else:
    if os.environ.has_key("PYTHONHOME"):
        pyhome=os.environ["PYTHONHOME"]
    else:
        pyhome=os.path.split( sys.executable )[0]
    self.docdir=os.path.join( pyhome, "doc" )

testfile=os.path.join( 
                os.path.join( self.docdir, "lib" ), "index.html")

if not os.path.exists( testfile ):
    raise EnvironmentError, ("Cannot find documentation directory" 
                        + self.docdir )
-- 
 Paul Prescod - Not encumbered by corporate consensus
It's difficult to extract sense from strings, but they're the only
communication coin we can count on. 
	- http://www.cs.yale.edu/~perlis-alan/quotes.html