Problems Generating HTML With pydoc

Discussion in 'Python' started by Juha S., Feb 26, 2008.

  1. Juha S.

    Juha S. Guest

    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.
     
    Juha S., Feb 26, 2008
    #1
    1. Advertising

  2. Juha S.

    Ron DuPlain Guest

    On Feb 26, 3:23 am, "Juha S." <> 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 <>
    http://www.linkedin.com/in/rduplain
     
    Ron DuPlain, Feb 29, 2008
    #2
    1. Advertising

  3. Juha S.

    Juha S. Guest

    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
     
    Juha S., Feb 29, 2008
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Peter Hansen

    Re: Securing PyDoc and CGIHTTPserver

    Peter Hansen, Jul 10, 2003, in forum: Python
    Replies:
    7
    Views:
    434
    Peter Hansen
    Jul 15, 2003
  2. Replies:
    1
    Views:
    2,443
  3. BartlebyScrivener

    pydoc script.py vs. pydoc scriptpy

    BartlebyScrivener, Oct 20, 2007, in forum: Python
    Replies:
    1
    Views:
    643
    Stargaming
    Oct 22, 2007
  4. Replies:
    2
    Views:
    566
  5. Faisal Vali
    Replies:
    10
    Views:
    238
    Thomas 'PointedEars' Lahn
    Jun 21, 2008
Loading...

Share This Page