To get help on python when in the PowerShell window, type:
python -m pydoc raw_input
substituting your function name for raw_input.
Answer from Mary Meerschaert on Stack OverflowUsing Learning Python the Hard Way by Zed Shaw, but having some trouble understanding the pydoc command in terminal.
I've a python file named ex12.py which I assume is the pydoc, so I know my command should be "python -m ex12.py" but I'm not getting any results.
As far as I know, -m stands for mod, but it just opens the file and runs it as if I were running it through Python.
Please help!
python - How to get pydoc command working in Windows 7 cmd? - Stack Overflow
python - How to get pydoc command working in Windows? - Stack Overflow
Pydoc in windows
python - How do I create documentation with Pydoc? - Stack Overflow
To get help on python when in the PowerShell window, type:
python -m pydoc raw_input
substituting your function name for raw_input.
Hey I know this post is a bit old, but I wanted to let you (and anyone else out there) know about this:
C:\Python27\Tools\scripts\pydocgui.py
It sets up a webserver on localhost:7464. Simply visit the address in your browser and you have access to pydoc :) Hope this helps someone
Use python -m pydoc os instead of pydoc directly, no need to add to path variable.
the -m tells python that pydoc is a pre-built module in python and NOT a script (.py file) sitting in the current working folder.
See https://docs.python.org/3/using/cmdline.html for details
PS adding C:\python27\Lib\pydoc.py to the Windows path in the system environment variables does not work. Even after logging out and back in it does not work.
The PATH environment variable is a list of directories to search for a given executable. So you should be adding C:\python27\Lib to your PATH (not including the filename).
As for the pydoc.bat file you've created, one place to put it would be the C:\python27\Scripts directory which is usually added to your PATH by the python installation (since that folder contains miscellaneous scripts that you might like available at the command line).
So I'm extremely new to python, yet my prof assigned a program in python to us anyways for a sort of trial by fire. My program works just fine, but I have no idea how to use pydoc on a windows machine.
My google fu has failed me. Many sources speak of a GUI, which isn't appearing whenever I try to run it. pydoc isn't a recognized command in the command line.
Basically...help?
Another thing that people may find useful...make sure to leave off ".py" from your module name. For example, if you are trying to generate documentation for 'original' in 'original.py':
yourcode_dir$ pydoc -w original.py no Python documentation found for 'original.py' yourcode_dir$ pydoc -w original wrote original.html
pydoc is fantastic for generating documentation, but the documentation has to be written in the first place. You must have docstrings in your source code as was mentioned by RocketDonkey in the comments:
"""
This example module shows various types of documentation available for use
with pydoc. To generate HTML documentation for this module issue the
command:
pydoc -w foo
"""
class Foo(object):
"""
Foo encapsulates a name and an age.
"""
def __init__(self, name, age):
"""
Construct a new 'Foo' object.
:param name: The name of foo
:param age: The ageof foo
:return: returns nothing
"""
self.name = name
self.age = age
def bar(baz):
"""
Prints baz to the display.
"""
print baz
if __name__ == '__main__':
f = Foo('John Doe', 42)
bar("hello world")
The first docstring provides instructions for creating the documentation with pydoc. There are examples of different types of docstrings so you can see how they look when generated with pydoc.