469,350 Members | 1,736 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,350 developers. It's quick & easy.

How to use pydoc?

>>> import pydoc
import sys
sys.version '2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)]' pydoc sys SyntaxError: invalid syntax


The documentation for pydoc says:
"Run "pydoc <name>" to show documentation on something."

What am I missing?

Thanks!
Chris

Dec 16 '05 #1
9 21947
ne********@cox.net wrote:
import pydoc
import sys
sys.version '2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)]' pydoc sys SyntaxError: invalid syntax
The documentation for pydoc says:
"Run "pydoc <name>" to show documentation on something."

What am I missing?


In the interpreter, just do
help(sys)
or
help("sys")


if you didn't already import the module.

What you tried is what you would do on the command line. I'm not sure it
works on windows, though, but

python -m pydoc sys

Should work on both windows and unix.

Peter

Dec 16 '05 #2
Thanks for replying Peter, but none of your suggestions are working.

S:\projects\C2PC\src>python -m
Unknown option: -m
usage: python [option] ... [-c cmd | file | -] [arg] ...

I should also be able to run 'pydoc -g' to start a webserver.

I guess I will have to write the author of pydoc for an answer.

Chris

Dec 16 '05 #3
ne********@cox.net wrote:
Thanks for replying Peter, but none of your suggestions are working.

S:\projects\C2PC\src>python -m
Unknown option: -m
usage: python [option] ... [-c cmd | file | -] [arg] ...
The -m option was added in Python 2.4, you must have an older version (though your OP
shows 2.4.2...). Try
python c:\python23\Lib\pydoc.py sys

or whatever the correct path is to python on your system.
I should also be able to run 'pydoc -g' to start a webserver.
python c:\python23\Lib\pydoc.py -g

or Start / Programs / Python 2.x / Module docs

Kent
I guess I will have to write the author of pydoc for an answer.

Chris

Dec 16 '05 #4
On Fri, 16 Dec 2005 07:23:57 -0800, newsposter wrote:
import pydoc
import sys
sys.version '2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)]' pydoc sys SyntaxError: invalid syntax


The documentation for pydoc says:
"Run "pydoc <name>" to show documentation on something."

What am I missing?

Thanks!
Chris


On a GNU/Linux distribution you can run in a shell the command 'pydoc -g'.
This start a little interface that start a little webserver, so it open an
webbrowser and go to a page where you easy find info about modules etc...
Dec 16 '05 #5
ne********@cox.net wrote:
Thanks for replying Peter, but none of your suggestions are working.

S:\projects\C2PC\src>python -m
Unknown option: -m
usage: python [option] ... [-c cmd | file | -] [arg] ...

I should also be able to run 'pydoc -g' to start a webserver.
Do you have multiple versions of Python on your computer?

The -m option only works with python2.4, so it seems Windows invoked a wrong
(older) Python version.

For older versions you can do

python c:\path\to\pydoc.py -g

Alternatively you can make sure you pick the right interpreter explicitly:

c:\path\to\python2.4\python.exe -m pydoc -g
I guess I will have to write the author of pydoc for an answer.


If none of the above works, be patient. Someone with a fresher Python on
Windows experience will eventually speak up :-)

Peter

Dec 16 '05 #6
ne********@cox.net wrote:
Thanks for replying Peter, but none of your suggestions are working.

S:\projects\C2PC\src>python -m
Unknown option: -m
usage: python [option] ... [-c cmd | file | -] [arg] ...

I should also be able to run 'pydoc -g' to start a webserver.

I guess I will have to write the author of pydoc for an answer.


if you look in the Python menu in the program menu, you'll find a
"module docs" entry that starts pydoc for you.

</F>

Dec 16 '05 #7
If it's just about displaying pydoc pages... SPE Python IDE has pydoc
built in. Just open any file and click on the pydoc tab, next to the
uml tab. Then you see the python documentation of that script, which is
generated on the fly, If you want to see documentation about the sys
module, just click in the upper right corner on the index link.

This works on Windows, Linux and Mac without a pain.

Stani
--
http://pythonide.stani.be

Dec 16 '05 #8
Thanks Peter. I do have two versions, with the older one existing for
compatibility with another application. Option -m works with 2.42. I
neglected to check this when I ran from the command-line.

Thanks,
Chris

Dec 16 '05 #9
Thanks! Yes, it brings up a documentation server, and serves up some
nicely formatted documentation. Learning learning...
-Chris

Dec 16 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Greg Kuperberg | last post: by
1 post views Thread by M.E.Farmer | last post: by
1 post views Thread by timw.google | last post: by
3 posts views Thread by Rob Cowie | last post: by
5 posts views Thread by Wijaya Edward | last post: by
4 posts views Thread by Ron Adam | last post: by
reply views Thread by w.m.gardella.sambeth | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.