Skip to content

Commit

Permalink
Document the -W option as best as I can.
Browse files Browse the repository at this point in the history
Get rid of BeOpen references.
  • Loading branch information
gvanrossum committed Dec 19, 2000
1 parent d1db30b commit 1378c32
Showing 1 changed file with 70 additions and 7 deletions.
77 changes: 70 additions & 7 deletions Misc/python.man
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ python \- an interpreted, interactive, object-oriented programming language
[
.B \-V
]
[
.B \-W
.I argument
]
.br
[
.B \-c
Expand Down Expand Up @@ -116,6 +120,71 @@ Prints the usage for the interpreter executable and exits.
.B \-V
Prints the Python version number of the executable and exits.
.TP
.BI "\-W " argument
Warning control. Python sometimes prints warning message to
.IR sys.stderr .
A typical warning message has the following form:
.IB file ":" line ": " category ": " message.
By default, each warning is printed once for each source line where it
occurs. This option controls how often warnings are printed.
Multiple
.B \-W
options may be given; when a warning matches more than one
option, the action for the last matching option is performed.
Invalid
.B \-W
options are ignored (a warning message is printed about invalid
options when the first warning is issued). Warnings can also be
controlled from within a Python program using the
.I warnings
module.

The simplest form of
.I argument
is one of the following
.I action
strings (or a unique abbreviation):
.B ignore
to ignore all warnings;
.B default
to explicitly request the default behavior (printing each warning once
per source line);
.B all
to print a warning each time it occurs (this may generate many
messages if a warning is triggered repeatedly for the same source
line, e.g. inside a loop);
.B module
to print each warning only only the first time it occurs in each
module;
.B once
to print each warning only the first time it occurs in the program; or
.B error
to raise an exception instead of printing a warning message.

The full form of
.I argument
is
.IB action : message : category : module : line.
Here,
.I action
is as explained above but only applies to messages that match the
remaining fields. Empty fields match all values; trailing empty
fields may be omitted. The
.I message
field matches the start of the warning message printed; this match is
case-insensitive. The
.I category
field matches the warning category. This must be a class name; the
match test whether the actual warning category of the message is a
subclass of the specified warning category. The full class name must
be given. The
.I module
field matches the (fully-qualified) module name; this match is
case-sensitive. The
.I line
field matches the line number, where zero matches all line numbers and
is thus equivalent to an omitted line number.
.TP
.BI "\-c " command
Specify the command to execute (see next section).
This terminates the option list (following options are passed as
Expand Down Expand Up @@ -250,20 +319,14 @@ the \fB\-v\fP option.
.SH AUTHOR
.nf
Guido van Rossum
BeOpen.com
160 Saratoga Avenue
Santa Clara, CA 95051
USA
.PP
E-mail: guido@beopen.com, guido@python.org
E-mail: [email protected]
.fi
.PP
And a cast of thousands.
.SH INTERNET RESOURCES
Main website: http://www.python.org
.br
BeOpen development team: http://pythonlabs.com
.br
Community website: http://starship.python.net
.br
Developer resources:
Expand Down

0 comments on commit 1378c32

Please sign in to comment.