Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

PYTHONDOCS

2 views
Skip to first unread message

J. D. Leach

unread,
Dec 31, 2005, 6:02:54 PM12/31/05
to
OK, I'm stupid. I have been unable to discern (even Googled) a way to set
the PYTHONDOCS variable to point to where the HTML files are. What to do? I
need to know the process and where theses variables are stored.
--
J. D. Leach
Columbus, Indiana USA

Linux/Open Source Computer using:
Mandrakelinux release 10.2 (Limited Edition 2005) for i586 kernel
2.6.11-6mdk

Fernando Perez

unread,
Dec 31, 2005, 7:45:14 PM12/31/05
to pytho...@python.org
J. D. Leach wrote:

> OK, I'm stupid. I have been unable to discern (even Googled) a way to set
> the PYTHONDOCS variable to point to where the HTML files are. What to do? I
> need to know the process and where theses variables are stored.

It's an environment variable. In my case:

PYTHONDOCS=/usr/share/doc/python-docs-2.3.4/html

You need to locate the proper dir on your system, and then use your shell's
syntax for this (export/setenv for bash/tcsh).

cheers,

f

Chris Smith

unread,
Dec 31, 2005, 3:06:01 PM12/31/05
to
>>>>> "J" == J D Leach <jdle...@sbcglobal.net> writes:

J> OK, I'm stupid. I have been unable to discern (even Googled) a
J> way to set the PYTHONDOCS variable to point to where the HTML
J> files are. What to do? I need to know the process and where
J> theses variables are stored. -- J. D. Leach Columbus, Indiana
J> USA

J> Linux/Open Source Computer using: Mandrakelinux release 10.2
J> (Limited Edition 2005) for i586 kernel 2.6.11-6mdk

J,
I'm stupider; I can't ATFQ for you.
But last night I stayed at a Holiday Inn Express, and can recommend

http://projects.edgewall.com/python-sidebar/

Which, assuming you've got connectivity, is teh shiznit.
HTH,
Chris

Mike Meyer

unread,
Dec 31, 2005, 10:48:24 PM12/31/05
to

Along the same lines, the OS X application launcher "Butler" comes
pre-configured with a "search python reference materials"
shortcut. I launch the shortcut, type in what I want,and hit enter,
and a browser window opens displaying the results of the
search. Adding other things - like searching the Python cookbook - is
relatively easy.

<mike
--
Mike Meyer <m...@mired.org> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.

J. D. Leach

unread,
Jan 1, 2006, 11:33:44 PM1/1/06
to
Mike Meyer wrote:

> Chris Smith <smitty_...@bigfoot.com> writes:
>>>>>>> "J" == J D Leach <jdle...@sbcglobal.net> writes:
>> I'm stupider; I can't ATFQ for you.
>> But last night I stayed at a Holiday Inn Express, and can recommend
>>
>> http://projects.edgewall.com/python-sidebar/
>>
>> Which, assuming you've got connectivity, is teh shiznit.
>
> Along the same lines, the OS X application launcher "Butler" comes
> pre-configured with a "search python reference materials"
> shortcut. I launch the shortcut, type in what I want,and hit enter,
> and a browser window opens displaying the results of the
> search. Adding other things - like searching the Python cookbook - is
> relatively easy.
>
> <mike

Thanks Mike for the link. I installed the sidebar and have found it to be an
invaluable aid in searching for info on Python. As for my problem with the
PYTHONDOCS variable, I still get the message about not having the
environment variable set. This is in spite of my setting the .bash profile
correctly. As it stands, I am at a loss for how to fix the problem. Using
the Mozilla sidebar, I found that the problem seems to involve several
OS's. However, the fixes suggested were the ones I have already applied.
Oh well, if I can't fix it, I'll just have to live with it.
--
J. D. Leach
Columbus, Indiana USA

Linux/Open Source Computer using:
Mandrakelinux release 10.2 (Limited Edition 2005) for i586 kernel
2.6.11-6mdk

Dan Sommers

unread,
Jan 2, 2006, 8:24:05 AM1/2/06
to
On Mon, 02 Jan 2006 04:33:44 GMT,
"J. D. Leach" <jdle...@sbcglobal.net> wrote:

> ... This is in spite of my setting the .bash profile correctly. As it
> stands, I am at a loss for how to fix the problem ...

As a long shot, and I don't mean to insult anyone, but what is the name
of your .bash profile, and are you sure it's executing? My bash man
page mentions a lot of profile files, none of which is called ".bash";
bash seems to have a mind of its own when it comes to deciding which
profile files to read at which times; and it's not uncommon to set a
variable and not export it, which means that echo works but nothing else
does.

Regards,
Dan

--
Dan Sommers
<http://www.tombstonezero.net/dan/>

J. D. Leach

unread,
Jan 2, 2006, 11:33:24 AM1/2/06
to
Dan Sommers wrote:

> As a long shot, and I don't mean to insult anyone, but what is the name
> of your .bash profile, and are you sure it's executing? My bash man
> page mentions a lot of profile files, none of which is called ".bash";
> bash seems to have a mind of its own when it comes to deciding which
> profile files to read at which times; and it's not uncommon to set a
> variable and not export it, which means that echo works but nothing else
> does.
>
> Regards,
> Dan

Not insulted at all Dan, I used to think I was quite proficient at all
things digital in my youth, then age and numerous serious goofs and
oversights on my part humbled me. The profile doc in question is
named .bash_profile and now carries the following line:

PYTHONDOCS=/usr/share/doc/python-2.4/html; export PYTHONDOCS

To insure that my environment has indeed been altered, a quick command line
entry using env shows this to be the case:

...some entries
LANG=en_US
PYTHONSTARTUP=/etc/pythonrc.py
PYTHONDOCS=/usr/share/doc/python-2.4/html
LESSOPEN=|/usr/bin/lesspipe.sh %s
BROWSER=/usr/bin/www-browser
...more entries

The above is in accordance with all written documentation I have been able
to obtain, both within my local Python file directories, and those I've
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:

Python 2.4.2 (#1, Dec 25 2005, 23:06:12)
[GCC 3.4.3 (Mandrakelinux 10.2 3.4.3-7mdk)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> help('and')

Sorry, topic and keyword documentation is not available because the Python
HTML documentation files could not be found. If you have installed them,
please set the environment variable PYTHONDOCS to indicate their location.

>>>

From the command line, if I enter:

[jdleach@deepgray ~]$ pydoc if


The same error is raised. And this is where it gets really strange. If I
load pydoc from within eric3 (python IDE I use), I receive:

...
>>> pydoc - the Python documentation tool

pydoc.py <name> ...
Show text documentation on something. <name> may be the name of a...
...more info

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

Peter Hansen

unread,
Jan 2, 2006, 12:47:18 PM1/2/06
to pytho...@python.org
J. D. Leach wrote:
> I'm lost. Surely I've missed something simple.

Maybe you can look in the source. "help" is an object defined by
site.py to be a "Helper" object from pydoc.py. Look in your Python lib
folder for pydoc.py and you should be able to trace through and find the
source of the problem. You can probably insert some print statements,
or maybe use "import pdb; pdb.set_trace" or some such approach.

-Peter

Peter Otten

unread,
Jan 2, 2006, 12:59:25 PM1/2/06
to
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

J. D. Leach

unread,
Jan 2, 2006, 3:15:11 PM1/2/06
to
Peter Otten wrote:

> What do you get if you do
>
>>>> import pydoc
>>>> pydoc.help.docdir
> '/should/be/path/to/docs'

The response is:
>>>import pydoc
>>>print pydoc.help.docdir
None
>>>

Obviously not there.

>
> 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

I believe you are right, a bug report is probably warranted here.

Peter Otten

unread,
Jan 2, 2006, 4:03:05 PM1/2/06
to
J. D. Leach wrote:

> The response is:
>>>>import pydoc
>>>>print pydoc.help.docdir
> None
>>>>
>
> Obviously not there.

You are getting no match rather than the wrong one. Have you verified that a
subdirectory

/usr/share/doc/python-2.4/html/lib

exists on your system? If not, the documentation may not be properly
installed.

Peter

J. D. Leach

unread,
Jan 2, 2006, 5:54:55 PM1/2/06
to
Peter Otten wrote:

>
> You are getting no match rather than the wrong one. Have you verified that
> a subdirectory
>
> /usr/share/doc/python-2.4/html/lib
>
> exists on your system? If not, the documentation may not be properly
> installed.
>
> Peter

I checked it Peter and rearranged the files in the python-2.4 directory
every which way absent deleting them, all to no avail. Interestingly, the
format and placement of the documentation was (before my modifications of
today) as originally installed when downloaded from python.org. I would
assume that they should have been in the correct order and directories when
initially installed.

Mike Meyer

unread,
Jan 2, 2006, 7:08:04 PM1/2/06
to
"J. D. Leach" <jdle...@sbcglobal.net> writes:
> Mike Meyer wrote:
>> Chris Smith <smitty_...@bigfoot.com> writes:
>>>>>>>> "J" == J D Leach <jdle...@sbcglobal.net> writes:
>>> I'm stupider; I can't ATFQ for you.
>>> But last night I stayed at a Holiday Inn Express, and can recommend
>>>
>>> http://projects.edgewall.com/python-sidebar/
>>>
>>> Which, assuming you've got connectivity, is teh shiznit.
>>
>> Along the same lines, the OS X application launcher "Butler" comes
>> pre-configured with a "search python reference materials"
>> shortcut. I launch the shortcut, type in what I want,and hit enter,
>> and a browser window opens displaying the results of the
>> search. Adding other things - like searching the Python cookbook - is
>> relatively easy.
>>
>> <mike
>
> Thanks Mike for the link.

To give credit where credit is due, Chris Smimth provided the link to
the sidebar. I didn't provide a link, but just mentioned a great
product that can be found at your favorite Mac software repository.

Florian Diesch

unread,
Jan 9, 2006, 6:33:28 PM1/9/06
to
J. D. Leach <jdle...@sbcglobal.net> wrote:
> Peter Otten wrote:
>
>>
>> You are getting no match rather than the wrong one. Have you verified that
>> a subdirectory
>>
>> /usr/share/doc/python-2.4/html/lib
>>
>> exists on your system? If not, the documentation may not be properly
>> installed.
>
> I checked it Peter and rearranged the files in the python-2.4 directory
> every which way absent deleting them, all to no avail. Interestingly, the

Do
strace -e trace=file -o /tmp/strace.log python -m pydoc 'if'
(or some other system call tracer that is available on your system)
and check /tmp/strace.log for where python is looking for the doc files.
Here it's /usr/share/doc/python2.4-doc/html/ref/if.html


Florian
--
Einen Troll zu füttern ist das gleiche als würde man einen Haufen
Hundescheisse sehen, absichtlich reinsteigen und sich dann beschweren.
(Christian Schneider in <2005-10-2...@bofh.my-fqdn.de>)

0 new messages