optparse.py: FutureWarning error

Discussion in 'Python' started by kosuke, Jun 2, 2005.

  1. kosuke

    kosuke Guest

    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
     
    kosuke, Jun 2, 2005
    #1
    1. Advertising

  2. kosuke

    Terry Reedy Guest

    "kosuke" <> wrote in message
    news:...
    >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
     
    Terry Reedy, Jun 2, 2005
    #2
    1. Advertising

  3. 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
     
    Michael Hoffman, Jun 3, 2005
    #3
  4. kosuke

    John Machin Guest

    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
     
    John Machin, Jun 3, 2005
    #4
  5. kosuke

    kosuke Guest

    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!
     
    kosuke, Jun 3, 2005
    #5
  6. kosuke

    Terry Reedy Guest

    "kosuke" <> wrote in message
    news:...
    > 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
     
    Terry Reedy, Jun 3, 2005
    #6
  7. kosuke

    Kent Johnson Guest

    Terry Reedy wrote:
    > "kosuke" <> wrote in message
    > news:...
    >
    >>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
     
    Kent Johnson, Jun 3, 2005
    #7
  8. 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
     
    Michael Hoffman, Jun 3, 2005
    #8
  9. kosuke

    Terry Reedy Guest

    "Kent Johnson" <> wrote in message
    news:42a02aba$...
    > Terry Reedy wrote:
    >> "kosuke" <> wrote in message
    >> news:...
    >>
    >>>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
     
    Terry Reedy, Jun 3, 2005
    #9
  10. kosuke

    Kent Johnson Guest

    Terry Reedy wrote:
    > "Kent Johnson" <> wrote in message
    > news:42a02aba$...
    >
    >>Terry Reedy wrote:
    >>
    >>>"kosuke" <> wrote in message
    >>>news:...
    >>>
    >>>
    >>>>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
     
    Kent Johnson, Jun 4, 2005
    #10
  11. kosuke

    Magnus Lycka Guest

    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.
     
    Magnus Lycka, Jun 8, 2005
    #11
  12. kosuke

    John Abel Guest

    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
     
    John Abel, Jun 8, 2005
    #12
  13. kosuke

    Kent Johnson Guest

    Kent Johnson wrote:
    > Terry Reedy wrote:
    >
    >> "Kent Johnson" <> wrote in message
    >> news:42a02aba$...
    >>
    >>> Terry Reedy wrote:
    >>>
    >>>> "kosuke" <> wrote in message
    >>>> news:...
    >>>>
    >>>>
    >>>>> 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.php?func=detail&aid=1217152&group_id=5470&atid=105470

    Kent
     
    Kent Johnson, Jun 8, 2005
    #13
  14. kosuke

    Magnus Lycka Guest

    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).
     
    Magnus Lycka, Jun 9, 2005
    #14
  15. kosuke

    John Abel Guest

    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
     
    John Abel, Jun 9, 2005
    #15
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bengt Richter
    Replies:
    6
    Views:
    537
    Juha Autero
    Aug 19, 2003
  2. Mike

    FutureWarning question

    Mike, Apr 13, 2004, in forum: Python
    Replies:
    2
    Views:
    364
    A. Lloyd Flanagan
    Apr 13, 2004
  3. Egor Bolonev

    FutureWarning

    Egor Bolonev, Dec 24, 2004, in forum: Python
    Replies:
    2
    Views:
    391
    Bengt Richter
    Dec 28, 2004
  4. Grant Edwards
    Replies:
    8
    Views:
    412
    J Correia
    Apr 6, 2005
  5. hofer
    Replies:
    2
    Views:
    920
    hofer
    Sep 26, 2008
Loading...

Share This Page