12

Obviously I am missing something serious here. Here is my test program:

"""
Doc and nothing but doc
"""

class TestMe(object):
    """
    class documentation goes here
    """
    def testFunc(self):
        """
        FunctionDoc Goes here
        """
        print "Hello world"

if __name__ =="__main__":
    t=TestMe()
    t.testFunc()

I run it and it prints "Hello world", natch. But pydoc.py test.py gives this:

no Python documentation found for 'test.py'

Obviously I am missing something simple here, but what?

--edit-- Per Vishnu's suggestion I added "print t.__doc__" to the last line of the file and now running the file gives this:

Hello world

    class documentation goes here

But pydoc still does not find any documentation.

3
  • 1
    Did you try TestMe.__doc__? Commented Nov 26, 2014 at 13:32
  • 2
    Have you tried the solutions posted here? stackoverflow.com/questions/13040646/… Commented Nov 26, 2014 at 13:39
  • Yup, that is what I looked at just before posting this. And why it seems to me that my test script above is right. Commented Nov 26, 2014 at 13:42

1 Answer 1

35

Pydoc wants a module name, not a file name. Try pydoc test.

It will use the argument as a file name if it has a slash in it: pydoc ./test.py

Sign up to request clarification or add additional context in comments.

1 Comment

Bingo! I knew it had to be something simple.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.