Problems Generating HTML With pydoc

Ron DuPlain ron.duplain at gmail.com
Thu Feb 28 22:41:33 EST 2008


On Feb 26, 3:23 am, "Juha S." <s... at iloinen.net> wrote:
> 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


--
Ron DuPlain <ron.duplain at gmail.com>
http://www.linkedin.com/in/rduplain



More information about the Python-list mailing list