473,386 Members | 1,835 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 22609
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Greg Kuperberg | last post by:
I plan to use pydoc for my Python project. After looking through the standard documentation, I am not sure how pydoc interprets its input. In its basic operation it evidently looks at the first...
0
by: Tony C | last post by:
According to the help for pydoc, it can be run as a script, from the command line. "Or, at the shell command line outside of Python: Run "pydoc <name>" to show documentation on something" ...
1
by: M.E.Farmer | last post by:
Hello again!, I just wanted to start off saying I love this newsgroup! Everytime I have an idea someone seems to post on it, or about it. The word for today is **Synchronicity** ! The reason for...
7
by: Brian van den Broek | last post by:
Hi all, I'm posting partly so my problem and solution might be more easily found by google, and partly out of mere curiosity. I've just spent a frustrating bit of time figuring out why pydoc...
1
by: timw.google | last post by:
Hi all, I'm discovering pydoc, and it seems to me that this is a great way to have online documentation for my application. Are there any examples of using this in some kind of help menu in an...
3
by: Rob Cowie | last post by:
I have searched this group and the wider net to find an answer to this, but I haven't been successful. Pydoc seems to be capable of writing documentation for all modules within a package by...
5
by: Wijaya Edward | last post by:
I tried to call pydoc from my Linux box. To my realization that it doesn't contain pydoc. I thought this module should be a default module. Can anybody suggest where can I find the module? I...
4
by: Ron Adam | last post by:
This is for a new version of pydoc if I can get the class attributes sorted out. The module level attributes aren't too difficult to categorize. (I might be just too tired to see the obvious.) ...
0
by: w.m.gardella.sambeth | last post by:
Hello Pythonists: I am using SPE as python IDE on Windows, with Python 2.5.1 installed (official distro). As my mother tongue is Spanish, I had documented some modules in it (I now, I should have...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.