473,466 Members | 1,457 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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

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.

Jul 18 '05 #1
0 2166

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Tim Williams | last post by:
I'm trying to write a simple python program to access a MySQL database. I'm having a problem with using MySQLdb to get the results of a SQL command in a cursor. Sometimes the cursor.execute works,...
6
by: asmirnov1234567890 | last post by:
Hi my python 2.3.4 for windows refuse to execute line float("NaN"). It says: >>> float("NaN") Traceback (most recent call last): File "<stdin>", line 1, in ? ValueError: invalid literal for...
4
by: Danny | last post by:
Hi I don't understand why I keep getting "Error: Object expected" I tried different things and haven't been able to solve it. I'm a newbie so I'm not sure what I'm doing wrong. The debugger breaks...
2
by: pango | last post by:
I write below code in my program: float f=0.371f; int i=(int)(f*1000.0f); I think the result of "i" should be "371",but in fact it is "370",why?How to solve it?
5
by: Peter Hansen | last post by:
I'm investigating a puzzling problem involving an attempt to generate a constant containing an (IEEE 754) "infinity" value. (I understand that special float values are a "platform-dependent...
16
by: chandanlinster | last post by:
As far as I know floating point variables, that are declared as float follow IEEE format representation (which is 32-bit in size). But chapter1-page no 9 of the book "The C programming language"...
29
by: candy_init | last post by:
Hi all, I just came across the following program: #include <stdio.h> int main() { float a = 12.5; printf("%d\n", a); printf("%d\n", *(int *)&a); return 0;
9
by: erictheone | last post by:
Ok so what I'm trying to do is create a trans location cipher. For those among us that don't know alot about cryptography it is a method for jumbling up letters to disguise linguistic...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.