[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

Problems Generating HTML With pydoc

Juha S.

2/26/2008 8:23:00 AM

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.
2 Answers

Ron DuPlain

2/29/2008 3:42:00 AM

0

On Feb 26, 3:23 am, "Juha S." <s...@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/~rdupl...
http://www.cv.nrao.edu/~rdupl...README

I hope this helps,

Ron


--
Ron DuPlain <ron.duplain@gmail.com>
http://www.linkedin.com/i...

Juha S.

2/29/2008 6:50:00 AM

0

Ron DuPlain wrote:
> 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