Re: [Tutor] How do you use pydoc?

2005-03-15 Thread Brian van den Broek
[EMAIL PROTECTED] said unto the world upon 2005-03-15 04:16:
 ok thanks for the help but i did what you said and heres what i got don't 
know exactly what i got but here lol 



 will you help me figer what i got out and the module docs dose not work whem 
i go to the browser in opens a window saying


580 Server Error

This Web page could not be opened. A connection to the page could not be 
made. Please click the Reload or Refresh button to try again.

 thanks agin
Hi,
1) *PLEASE* reply to all. This is particularly important in cases like 
the present one, where I personally have no idea what the trouble is, 
and thus don't have the ability to help.

2) Sending the results of help(HTMLParser), etc. isn't useful -- it 
makes for a giant email the contents of which we all can get by typing 
help(HTMLParser) in our own python shells :-) It is better to send 
just the unexpected things.

As for the problem:
For me, the 580 Server Error is unexpected, indeed. And, I'm afraid it 
takes us past my competency and knowledge level. Though I do wonder if 
you are running a firewall such as ZoneAlaram -- that could interfere 
with Module Docs attempts to serve up documentation. But that's just a 
guess: *I* can't help further.

Best,
Brian vdB
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How do you use pydoc?

2005-03-15 Thread Kent Johnson
[EMAIL PROTECTED] wrote:
*
  I have read but don't under stand how to use pydoc. here what i read 
can't figer out how to use it.
One way to use pydoc is to start up a mini web server that delivers module documentation. On 
Windows, start the server with Start / Programs / Python / Module Docs. Click the Open browser 
button and you can browse the docstrings for all installed modules.

Kent
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How do you use pydoc?

2005-03-14 Thread Brian van den Broek
[EMAIL PROTECTED] said unto the world upon 2005-03-14 19:28:
I have read but don't under stand how to use pydoc. here what i
read can't figer out how to use it.
Hi,
try this:
Fire up IDLE and your web browser of choice.
In IDLE's shell, type:
import HTMLParser
There is nothing special about the HTMLParser module other than that 
it is a pure Python module -- I just wanted to pick a concrete case 
for the discussion here.

Now type:
help(HTMLParser)
There. You are now using pydoc :-) It is displaying the documentation 
for the module HTMLParser. Now try typing

help(HTMLParser.HTMLParser)
That's the documentation for one class in the module.
help(HTMLParser.HTMLParser.close)
The documentation for one method of that class.
Now, in the Start Menu entries for Python, find the icon for Module
Docs. Click it, and then click open browser. Scroll down until you see
HTMLParser, and click on it. Your web browser should give you the same 
info as you got from help(HTMLParser), but in a nicer format. That's 
pydoc at work, too.

In IDLE's editor, open HTMLParser.py (mine's at
C:\Python24\Lib\HTMLParser.py).
Now, look at the file HTMLParser.py and compare that to the outputs
that you got above. See if you can see where the help() command got
its output from. The parts of the output that come from text in triple 
quotes are docstrings. Put them in your own modules and functions, and 
you can use help or Module Docs to remind you of what you own code does.

Save a backup copy of HTMLParser.py, and try adding docstrings to
methods like HTMLParser.HTMLParser.handle_comment, and see if you can
see how and why the '#' lines ended up in the help() and Module Docs
output. (Don't forget to save your changes before trying to view them
in your web browser with Module Docs -- and don't forget to restore
the backup when you are done! This is easier to do with Module Docs 
than in the IDLE shell as in the shell pydoc won't know about your 
changes unless you reload the module.)

Best,
Brian vdB
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How do you use pydoc?

2005-03-14 Thread Max Noel
On Mar 15, 2005, at 00:28, [EMAIL PROTECTED] wrote:
   I have read but don't under stand how to use pydoc. here what i 
read can't figer out how to use it.
	pydoc is more or less a help browser. Think of it as "man for Python". 
If you need documentation on a module, just type "pydoc [module name]" 
at a command prompt. For example, if you want to know how the os module 
works, just type "pydoc os".

	Even better: if the modules you're writing use docstrings, then 
calling pydoc on your module will work automagically.

-- Max
maxnoel_fr at yahoo dot fr -- ICQ #85274019
"Look at you hacker... A pathetic creature of meat and bone, panting 
and sweating as you run through my corridors... How can you challenge a 
perfect, immortal machine?"

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] How do you use pydoc?

2005-03-14 Thread Jeff420harris00

   I have read but don't under stand how to use pydoc. here what i read can't figer out how to use it.


5.1 pydoc -- Documentation generator and online help system 

New in version 2.1. The pydoc module automatically generates documentation from Python modules. The documentation can be presented as pages of text on the console, served to a Web browser, or saved to HTML files. The built-in function help() invokes the online help system in the interactive interpreter, which uses pydoc to generate its documentation as text on the console. The same text documentation can also be viewed from outside the Python interpreter by running pydoc as a script at the operating system's command prompt. For example, running pydoc sys
at a shell prompt will display documentation on the sys module, in a style similar to the manual pages shown by the Unix man command. The argument to pydoc can be the name of a function, module, or package, or a dotted reference to a class, method, or function within a module or module in a package. If the argument to pydoc looks like a path (that is, it contains the path separator for your operating system, such as a slash in Unix), and refers to an existing Python source file, then documentation is produced for that file. Specifying a -w flag before the argument will cause HTML documentation to be written out to a file in the current directory, instead of displaying text on the console. Specifying a -k flag before the argument will search the synopsis lines of all available modules for the keyword given as the argument, again in a manner similar to the Unix man command. The synopsis line of a module is the first line of its documentation string. You can also use pydoc to start an HTTP server on the local machine that will serve documentation to visiting Web browsers. pydoc -p 1234 will start a HTTP server on port 1234, allowing you to browse the documentation at http://localhost:1234/ in your preferred Web browser. pydoc -g will start the server and additionally bring up a small Tkinter-based graphical interface to help you search for documentation pages. When pydoc generates documentation, it uses the current environment and path to locate modules. Thus, invoking pydoc spam documents precisely the version of the module you would get if you started the Python interpreter and typed "import spam". Module docs for core modules are assumed to reside in http://www.python.org/doc/current/lib/. This can be overridden by setting the PYTHONDOCS environment variable to a different URL or to a local directory containing the Library Reference Manual pages. 


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor