Problems Generating HTML With pydoc

J

Juha S.

Hi,

I'm trying to generate HTML docs for a Python package (directory)
currently containing an empty __init__.py and a Module.py file with some
classes and docstrings. I tried using the command
"F:\path\to\project\pydoc.py -w myPackage" at the Vista command prompt,
and I get "wrote myPackage.html" as output, but when I open the .html in
Firefox, I cannot navigate to the doc page of Module although it is
displayed as a link on the main page. I get a File Not Found message in
the browser for doing so.

If I'm at C:\ in the command prompt and try "pydoc.py -w
F:\path\to\project\myPackage" I get "no Python documentation found for
'Module'".

pydoc -g seems to display the package's doc .htmls with no problems. I
can't seem to figure what's wrong here, so any help is appreciated.
 
R

Ron DuPlain

Hi,

I'm trying to generate HTML docs for a Python package (directory)
currently containing an empty __init__.py and a Module.py file with some
classes and docstrings. I tried using the command
"F:\path\to\project\pydoc.py -w myPackage" at the Vista command prompt,
and I get "wrote myPackage.html" as output, but when I open the .html in
Firefox, I cannot navigate to the doc page of Module although it is
displayed as a link on the main page. I get a File Not Found message in
the browser for doing so.

I also expected "pydoc -w mypackage" to recursively generate html for
the whole package, but it only wrote the top-level file for me as well
(on Linux, for the record).
If I'm at C:\ in the command prompt and try "pydoc.py -w
F:\path\to\project\myPackage" I get "no Python documentation found for
'Module'".

I use the workaround:
pydoc -w ./

This runs "pydoc -w" on all Python files in the current directory and
its subdirectories.
On Windows, you'll probably have to use:
pydoc -w .\

.... or "F:\path\to\project\pydoc.py -w .\"

You can simplify this in Windows by adding the directory containing
pydoc.py to the PATH environment variable, and by adding .PY to
PATHEXT. Doing so should allow you to call just "pydoc" from the
Windows command prompt (without "F:\...\pydoc.py"). Be sure to start
a new command prompt after changing these environment settings.
pydoc -g seems to display the package's doc .htmls with no problems. I
can't seem to figure what's wrong here, so any help is appreciated.

Yes, pydoc -g worked just fine for me before trying this workaround.

If you'd like some more information, I created a pydoc example which
you can browse/download. It also serves as an example of my
interpretation of "Style Guide for Python Code" (PEP 8) and "Docstring
Conventions" (PEP 257), both of which provide excellent guidelines for
generating meaningful pydoc files.

http://www.cv.nrao.edu/~rduplain/pydoc/
http://www.cv.nrao.edu/~rduplain/pydoc/README

I hope this helps,

Ron
 
J

Juha S.

Ron said:
I also expected "pydoc -w mypackage" to recursively generate html for
the whole package, but it only wrote the top-level file for me as well
(on Linux, for the record)

I use the workaround:
pydoc -w ./

This runs "pydoc -w" on all Python files in the current directory and
its subdirectories.
On Windows, you'll probably have to use:
pydoc -w .\

... or "F:\path\to\project\pydoc.py -w .\"

Thanks! That seemed to do the trick.

Regards,
Juha
 

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,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top