473,698 Members | 2,528 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 22652
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\C2P C\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\C2P C\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\C2P C\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\pydo c.py -g

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

c:\path\to\pyth on2.4\python.ex e -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\C2P C\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
3111
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 string literal in the module and in each function definition. But there is more to the story than that, obviously. What other vestigial code does it detect? Every string literal? Variables of the form __xxx__, I gather? Which of these variables...
0
2029
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" However, when I run pydoc from the Windows XP command line, it launches my editor (Codewright) and displays pydoc.py in the editor. I want to be able to use it to display docstrings in my modules, from
1
1503
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 this post is to talk about pydoc. I have been writing a module that colorizes source code, and have hoped to make it work with pydoc. I saw a thread 2 days ago about pydoc and firefox having issues. (Actually all Mozilla based browsers ignore...
7
3974
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 didn't extract a description from my module docstrings. Even though I had a well formed docstring (one line, followed by a blank line, followed by the rest of the docstring), when I ran Module docs, my modules showed up as having "no description"....
1
2184
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 application? I've tried to just bind pydoc.gui() to a menu item, but this just brings up the GUI for pydoc, and the user still needs to search for the module before the browser comes up, and when I quit serving pydoc.gui(), my application dies...
3
7446
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 simply pointing it to the package on the command line... pydoc -w <packagename_without_/> Certainly, the method writedocs() appears to descend into a directory
5
3699
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 tried: $ easy_install pydoc
4
1462
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.) The original pydoc did this a somewhat round about way, so I would like to find a more direct method if possible. Where dir(obj) is used to get all attributes of a module or class. And
0
1237
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 documented all in English, except if I were 110% sure than nobody else would read my docs, but they are only for in-house use). When I tried to use the pydoc tab that SPE attaches to every source file, I only found a message saying that my...
0
8680
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8609
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9169
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9030
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8899
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8871
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7738
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5861
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.