mx.DateTime bogus warning: "float where int expected"

Discussion in 'Python' started by python@sarcastic-horse.com, Sep 17, 2003.

  1. Guest

    Hi-


    I'm getting a "DeprecationWarning: integer argument expected, got float"
    warning with mx.DateTime and I can't figure out why. Can anyone help me
    out?

    This code:

    import mx.DateTime

    class xLabeller:
    def __init__(self, firstdate,fmt='%B, %Y'):
    self.firstdate = firstdate
    self.fmt = fmt
    self.mm = mx.DateTime.RelativeDateTime(months=1)
    def __call__(self, i):
    dt = self.firstdate + self.mm * int(i)
    return dt.Format(self.fmt)

    nov99 = mx.DateTime.Date(int(1999), int(11))

    xl = xLabeller(nov99)
    print "xl2:"
    print xl(int(3))

    Produces this warning:

    >>> ================================ RESTART ===========
    >>>

    xl2:
    C:\Python23\lib\site-packages\mx\DateTime\DateTime.py:585:
    DeprecationWarning: integer argument expected, got float
    return DateTime(year, month, 1) + \
    February, 2000

    What is the story? I've wrapped every number in my program with int(). I
    can't figure out what's triggering the warning.

    And, even stranger, the whole thing works fine at the python shell:

    >>> import mx.DateTime
    >>> mm = mx.DateTime.RelativeDateTime(months=1)
    >>> nov99

    <DateTime object for '1999-11-01 00:00:00.00' at 98dc20>
    >>> dt = nov99 + mm * 3
    >>> dt.Format('%b, %y')

    'Feb, 00'
    >>>


    What am I doing wrong?


    Thanks for the help.
     
    , Sep 17, 2003
    #1
    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. Christos TZOTZIOY Georgiou
    Replies:
    3
    Views:
    765
    Christos TZOTZIOY Georgiou
    Sep 13, 2003
  2. Tim Peters
    Replies:
    0
    Views:
    602
    Tim Peters
    Sep 9, 2003
  3. mp
    Replies:
    1
    Views:
    444
    John Machin
    Jul 28, 2006
  4. Martin
    Replies:
    0
    Views:
    378
    Martin
    Dec 27, 2008
  5. steve

    bogus warning?

    steve, Oct 13, 2011, in forum: C Programming
    Replies:
    15
    Views:
    1,001
    Ben Bacarisse
    Oct 15, 2011
Loading...

Share This Page