Program stopped working on February 1st.

Hi

I have written a program that uses wx and it stopped working on
February 1st. On all platforms and even older versions that used to
run fine stopped working.
If I change the system date back to January the program is running
again fine.

Here is a sample program that raises the error:

#!/usr/bin/python
import wx
enddate = wx.DateTimeFromDMY(30, month = 12, year = 2020)
print enddate

And the error message:
13:41:51: Debug: ..\..\src\common\datetime.cpp(1466): assert "(0 <
day) && (day <= GetNumberOfDays(month, year))" failed in
wxDateTime::Set(): Invalid date in wxDateTime::Set()

I assume there is a bug in wxPython or wx?

Best Regards
Simon Baechler

Simon,

Hi

I have written a program that uses wx and it stopped working on
February 1st. On all platforms and even older versions that used to
run fine stopped working.
If I change the system date back to January the program is running
again fine.

Here is a sample program that raises the error:

#!/usr/bin/python
import wx
enddate = wx.DateTimeFromDMY(30, month = 12, year = 2020)
print enddate

And the error message:
13:41:51: Debug: ..\..\src\common\datetime.cpp(1466): assert "(0<
day)&& (day<= GetNumberOfDays(month, year))" failed in
wxDateTime::Set(): Invalid date in wxDateTime::Set()

I assume there is a bug in wxPython or wx?
   

I get this:

enddate = wx.DateTimeFromDMY(30, month = 12, year = 2020)
>>> print enddate
INVALID DateTime
>>> enddate = wx.DateTimeFromDMY(30, month = 11, year = 2020)
>>> print enddate
30/12/2020 00:00:00

I don't know why you don't just get "INVALID DateTime" on your machine - note that month is zero based.

What system and versions are you running?

Werner

···

On 07/02/2010 13:49, sbaechler wrote:

In addition to the platform and version you are using it would be helpful to know what your timezone and locale settings are, as there is a fair bit of timezone specific code in wx.DateTime.

As Wener mentioned the date you use above is invalid because of the zero-offset of the months, (wx.DateTime.Jan is zero and wx.DateTime.Dec is 11) so what was the actual date in your application that started having problems on Feb 1st? Was it related to Feb 1st in any way?

···

On 2/7/10 4:49 AM, sbaechler wrote:

Hi

I have written a program that uses wx and it stopped working on
February 1st. On all platforms and even older versions that used to
run fine stopped working.
If I change the system date back to January the program is running
again fine.

Here is a sample program that raises the error:

#!/usr/bin/python
import wx
enddate = wx.DateTimeFromDMY(30, month = 12, year = 2020)
print enddate

And the error message:
13:41:51: Debug: ..\..\src\common\datetime.cpp(1466): assert "(0<
day)&& (day<= GetNumberOfDays(month, year))" failed in
wxDateTime::Set(): Invalid date in wxDateTime::Set()

I assume there is a bug in wxPython or wx?

--
Robin Dunn
Software Craftsman

I have written a program that uses wx and it stopped working on
February 1st. On all platforms and even older versions that used to
run fine stopped working.
If I change the system date back to January the program is running
again fine.

Here is a sample program that raises the error:

#!/usr/bin/python
import wx
enddate = wx.DateTimeFromDMY(30, month = 12, year = 2020)
print enddate

Actually, I'll bet real dollars that the scenario you encountered was
actually this:
    enddate = wx.DateTimeFromDMY( 30, month = 1, year = 2010 )

And the error message:
13:41:51: Debug: ..\..\src\common\datetime.cpp(1466): assert "(0 <
day) && (day <= GetNumberOfDays(month, year))" failed in
wxDateTime::Set(): Invalid date in wxDateTime::Set()

The line I show will cause that error, because "month=1" is February,
and there is no such thing as February 30.

···

On Feb 7, 4:49 am, sbaechler <s...@feinheit.ch> wrote:
--
Tim Roberts
Providenza & Boekelheide, Inc.