469,898 Members | 1,605 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

optparse.py: FutureWarning error

I keep getting the following error/warning message when using the
python based program getmail4:

/usr/lib/python2.3/optparse.py:668: FutureWarning: %u/%o/%x/%X of
negative int will return a signed string in Python 2.4 and up
return ("<%s at 0x%x: %r>"

I'm using python2.3.5 on a debian sid box.

The getmail4 website/FAQ maintains that this is a bug in the optparse
module.

Any idea on how to resolve this?

Thanks
Kevin

Jul 19 '05 #1
14 1792

"kosuke" <ke***@rustybear.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
I keep getting the following error/warning message when using the
python based program getmail4:

/usr/lib/python2.3/optparse.py:668: FutureWarning: %u/%o/%x/%X of
negative int will return a signed string in Python 2.4 and up
return ("<%s at 0x%x: %r>"

I'm using python2.3.5 on a debian sid box.

The getmail4 website/FAQ maintains that this is a bug in the optparse
module.

Any idea on how to resolve this?


a) Learn to live with it ;-)
b) Upgrade to 2.4 (if getmail4 will run with it)
c) Check to see if Python has a startup option for suppressing warnings

As to c) python -h gives a list indicating what I thought, that -W controls
warnings, but gives insufficient info for me to use it, and I didn't find
any more in the docs. I hope someone else chimes in.

Terry J. Reedy
Terry J. Reedy

Jul 19 '05 #2
Terry Reedy wrote:
c) Check to see if Python has a startup option for suppressing warnings

As to c) python -h gives a list indicating what I thought, that -W controls
warnings, but gives insufficient info for me to use it, and I didn't find
any more in the docs. I hope someone else chimes in.


man python. Search for -W.
--
Michael Hoffman
Jul 19 '05 #3
Michael Hoffman wrote:
Terry Reedy wrote:
c) Check to see if Python has a startup option for suppressing warnings

As to c) python -h gives a list indicating what I thought, that -W
controls warnings, but gives insufficient info for me to use it, and I
didn't find any more in the docs. I hope someone else chimes in.

man python. Search for -W.


"""
C:\junk>man python
'man' is not recognized as an internal or external command,
operable program or batch file.
"""

Could someone please post a copy of the whole of the arg section of the
"man python" output, for the benefit of Windows users?

TIA,
John
Jul 19 '05 #4
man python ---

COMMAND LINE OPTIONS
-c command
Specify the command to execute (see next section). This
terminates the option list (following options are passed as arguments
to
the command).

-d Turn on parser debugging output (for wizards only,
depending on compilation options).

-E Ignore environment variables like PYTHONPATH and
PYTHONHOME that modify the behavior of the interpreter.

-h Prints the usage for the interpreter executable and
exits.

-i When a script is passed as first argument or the -c
option is used, enter interactive mode after executing the script or
the com-
mand. It does not read the $PYTHONSTARTUP file. This
can be useful to inspect global variables or a stack trace when a
script
raises an exception.

-O Turn on basic optimizations. This changes the
filename extension for compiled (bytecode) files from .pyc to .pyo.
Given twice,
causes docstrings to be discarded.

-Q argument
Division control; see PEP 238. The argument must be one
of "old" (the default, int/int and long/long return an int or long),
"new"
(new division semantics, i.e. int/int and long/long
returns a float), "warn" (old division semantics with a warning for
int/int and
long/long), or "warnall" (old division semantics with a
warning for all use of the division operator). For a use of "warnall",
see
the Tools/scripts/fixdiv.py script.

-S Disable the import of the module site and the
site-dependent manipulations of sys.path that it entails.

-t Issue a warning when a source file mixes tabs and
spaces for indentation in a way that makes it depend on the worth of a
tab
expressed in spaces. Issue an error when the option is
given twice.

-u Force stdin, stdout and stderr to be totally unbuffered.
On systems where it matters, also put stdin, stdout and stderr in
binary
mode. Note that there is internal buffering in
xreadlines(), readlines() and file-object iterators ("for line in
sys.stdin") which
is not influenced by this option. To work around this,
you will want to use "sys.stdin.readline()" inside a "while 1:" loop.
-v Print a message each time a module is initialized,
showing the place (filename or built-in module) from which it is
loaded. When
given twice, print a message for each file that is
checked for when searching for a module. Also provides information on
module
cleanup at exit.

-V Prints the Python version number of the executable and
exits.

-W argument
Warning control. Python sometimes prints warning message
to sys.stderr. A typical warning message has the following
form:
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 -W options may
be given; when a warning matches more than one option, the action for
the
last matching option is performed. Invalid -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 warnings module.

The simplest form of argument is one of the following
action strings (or a unique abbreviation): ignore to ignore all
warnings;
default to explicitly request the default behavior
(printing each warning once per source line); 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, such as inside a
loop);
module to print each warning only only the first time
it occurs in each module; once to print each warning only the first
time it
occurs in the program; or error to raise an exception
instead of printing a warning message.

The full form of argument is
action:message:category:module:line. Here, 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 message field
matches
the start of the warning message printed; this match is
case-insensitive. The 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
cat-
egory. The full class name must be given. The module
field matches the (fully-qualified) module name; this match is
case-sensi-
tive. The line field matches the line number, where
zero matches all line numbers and is thus equivalent to an omitted line
num-
ber.

-x Skip the first line of the source. This is intended for
a DOS specific hack only. Warning: the line numbers in error
messages
will be off by one!

Jul 19 '05 #5

"kosuke" <ke***@rustybear.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
man python ---

COMMAND LINE OPTIONS


This should REALLY be on the doc page of the Python site. I remember
asking for this about 7 years ago and being ridiculed for only having
Windows. It is really time to stop pretending that the only Python users
that count have a *nix on their desk.

Terry J. Reedy

Jul 19 '05 #6
Terry Reedy wrote:
"kosuke" <ke***@rustybear.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
man python ---

COMMAND LINE OPTIONS

This should REALLY be on the doc page of the Python site.


Hear, hear! I never even knew this existed!

Where should it go in the docs? In the Language Reference or the Tutorial or...?

Kent
Jul 19 '05 #7
John Machin wrote:
Michael Hoffman wrote:
Terry Reedy wrote:
c) Check to see if Python has a startup option for suppressing warnings

As to c) python -h gives a list indicating what I thought, that -W
controls warnings, but gives insufficient info for me to use it, and
I didn't find any more in the docs. I hope someone else chimes in.


man python. Search for -W.

"""
C:\junk>man python
'man' is not recognized as an internal or external command,
operable program or batch file.
"""


Well it's obviously not going to work if you don't install man. <wink>

"""
C:\Documents and Settings\MichaelH>man python

PYTHON(1)

NAME

python - an interpreted, interactive, object-oriented programming language
"""

Here's a copy of the man page:

http://linuxcommand.org/man_pages/python1.html
--
Michael Hoffman
Jul 19 '05 #8

"Kent Johnson" <ke****@tds.net> wrote in message
news:42**********@newspeer2.tds.net...
Terry Reedy wrote:
"kosuke" <ke***@rustybear.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
man python ---

COMMAND LINE OPTIONS

This should REALLY be on the doc page of the Python site.


Hear, hear! I never even knew this existed!

Where should it go in the docs? In the Language Reference or the Tutorial
or...?


Since the Tutorial already has section 2. Using the Python Interpreter that
discusses a few of the switches, I would add it as an appendix with a
reference to the appendix at the end of the appropriate subsection.
Perhaps I will submit a tracker item.

Terry J. Reedy

Jul 19 '05 #9
Terry Reedy wrote:
"Kent Johnson" <ke****@tds.net> wrote in message
news:42**********@newspeer2.tds.net...
Terry Reedy wrote:
"kosuke" <ke***@rustybear.com> wrote in message
news:11**********************@g47g2000cwa.googl egroups.com...
man python ---

COMMAND LINE OPTIONS
This should REALLY be on the doc page of the Python site.


Hear, hear! I never even knew this existed!

Where should it go in the docs? In the Language Reference or the Tutorial
or...?

Since the Tutorial already has section 2. Using the Python Interpreter that
discusses a few of the switches, I would add it as an appendix with a
reference to the appendix at the end of the appropriate subsection.
Perhaps I will submit a tracker item.


Sounds good to me.

Kent
Jul 19 '05 #10
Terry Reedy wrote:
This should REALLY be on the doc page of the Python site. Agreed.
It is really time to stop pretending that the only Python users
that count have a *nix on their desk.

I agree with this too, but if you're a programmer
on the Windows platform with possibility to install
software on the machine you work with, I strongly
suggest that you install cygwin or something
equivalent. Not just for "man python". Tools like
grep and find are vastly superior to anything I've
seen natively on windows if you want to process the
data you find in some automated way.

In my experience, Windows 2000 and later are fairly
decent operating systems if you have Python and
cygwin installed, but I'd feel awfully handicapped
without those tools.
Jul 19 '05 #11
Magnus Lycka wrote:
Terry Reedy wrote:

This should REALLY be on the doc page of the Python site.

Agreed.
It is really time to stop pretending that the only Python users
that count have a *nix on their desk.

I agree with this too, but if you're a programmer
on the Windows platform with possibility to install
software on the machine you work with, I strongly
suggest that you install cygwin or something
equivalent. Not just for "man python". Tools like
grep and find are vastly superior to anything I've
seen natively on windows if you want to process the
data you find in some automated way.

In my experience, Windows 2000 and later are fairly
decent operating systems if you have Python and
cygwin installed, but I'd feel awfully handicapped
without those tools.

As a programmer on Win32, and *nix platforms, I agree with needing
better tools. however, I find cygwin a pita. For tools such as grep
and find, try this http://unxutils.sourceforge.net/. No need for cygwin
( though that's not say cygwin isn't useful ).

J
Jul 19 '05 #12
Kent Johnson wrote:
Terry Reedy wrote:
"Kent Johnson" <ke****@tds.net> wrote in message
news:42**********@newspeer2.tds.net...
Terry Reedy wrote:

"kosuke" <ke***@rustybear.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
> man python ---
>
> COMMAND LINE OPTIONS

This should REALLY be on the doc page of the Python site.
Hear, hear! I never even knew this existed!

Where should it go in the docs? In the Language Reference or the
Tutorial or...?


Since the Tutorial already has section 2. Using the Python Interpreter
that discusses a few of the switches, I would add it as an appendix
with a reference to the appendix at the end of the appropriate
subsection. Perhaps I will submit a tracker item.

Sounds good to me.

Kent


I have submitted this as
http://sourceforge.net/tracker/index...70&atid=105470

Kent
Jul 19 '05 #13
John Abel wrote:
Magnus Lycka wrote: As a programmer on Win32, and *nix platforms, I agree with needing
better tools. however, I find cygwin a pita. For tools such as grep
and find, try this http://unxutils.sourceforge.net/. No need for cygwin
( though that's not say cygwin isn't useful ).


Is there any shell there? While I do think that "cd /cygdrive/c" is a
bit silly, I still prefer bash to Microsoft's cmd.exe (even if cmd.exe
is much, much better than the old command.com).
Jul 19 '05 #14
Magnus Lycka wrote:
John Abel wrote:

Magnus Lycka wrote:

As a programmer on Win32, and *nix platforms, I agree with needing
better tools. however, I find cygwin a pita. For tools such as grep
and find, try this http://unxutils.sourceforge.net/. No need for cygwin
( though that's not say cygwin isn't useful ).


Is there any shell there? While I do think that "cd /cygdrive/c" is a
bit silly, I still prefer bash to Microsoft's cmd.exe (even if cmd.exe
is much, much better than the old command.com).

There is a sh, but no bash, scroll down the the linked page for a full
list of the executables.

J
Jul 19 '05 #15

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.