PYTHONDOCS

C

Chris Smith

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
 
J

J. D. Leach

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
 
F

Fernando Perez

J. D. Leach said:
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
 
M

Mike Meyer

Chris Smith said:
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
 
J

J. D. Leach

Mike said:
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
 
D

Dan Sommers

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

J. D. Leach

Dan said:
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.
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.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:

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

Peter Hansen

J. D. Leach said:
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
 
P

Peter Otten

J. D. Leach said:
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:


...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
'/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

J. D. Leach

Peter said:
What do you get if you do

'/should/be/path/to/docs'

The response is:
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.
 
P

Peter Otten

J. D. Leach said:
The response is:

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

J. D. Leach

Peter said:
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.
 
M

Mike Meyer

J. D. Leach said:
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.

<mike
 
F

Florian Diesch

J. D. Leach said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top