Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Problems Generating HTML With pydoc

Reply
Thread Tools

Problems Generating HTML With pydoc

 
 
Juha S.
Guest
Posts: n/a
 
      02-26-2008
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.
 
Reply With Quote
 
 
 
 
Ron DuPlain
Guest
Posts: n/a
 
      02-29-2008
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 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
 
Reply With Quote
 
 
 
 
Juha S.
Guest
Posts: n/a
 
      02-29-2008
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
dynamically generating html vs using html scaffolding? Faisal Vali Javascript 10 06-21-2008 04:31 PM
pydoc - generating HTML docs from string input gregpinero@gmail.com Python 2 11-07-2007 11:22 PM
pydoc script.py vs. pydoc scriptpy BartlebyScrivener Python 1 10-22-2007 03:21 PM
How can I use PyDoc to generate html file (modul in directory d) ajikoe@gmail.com Python 1 02-01-2005 07:20 AM
Re: Securing PyDoc and CGIHTTPserver Peter Hansen Python 7 07-15-2003 01:03 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57