Why doesn't response pydoc on my Python 2.7?

Erik python at lucidity.plus.com
Sat Dec 12 19:17:55 EST 2015


Hi Robert,

On 13/12/15 00:04, Robert wrote:
> Excuse me for the incomplete information on previous posts.
> Here is the message when I run it on Canopy (module1.py and module2.py
> are in the current folder):
>
> Welcome to Canopy's interactive data-analysis environment!
>   with pylab-backend set to: qt
> Type '?' for more information.

I don't have any experience with "Canopy", but it looks to me like it is 
providing you with an interactive Python environment.

> In [1]: pydoc module1
>    File "<ipython-input-1-cebe02de9045>", line 1
>      pydoc module1
>                  ^
> SyntaxError: invalid syntax

As this is an interactive Python environment, then Python syntax is 
required. Remember what "help(pydoc)" told you:

"""
In the Python interpreter, do "from pydoc import help" to provide online
     help.  Calling help(thing) on a Python object documents the object.
"""

So, instead of "pydoc module1" (which is not good Python syntax), do 
what the help document tells you to do within a Python interpreter:

import module1
pydoc.help(module1)

import module2
pydoc.help(module2)

Does that work better?

E.



More information about the Python-list mailing list