[IronPython] script for seconds in given month, year

Dino Viehland dinov at exchange.microsoft.com
Mon Apr 23 22:41:24 CEST 2007

What version of IronPython are you using?  This works for me w/ IronPython v1.1 and the 2.4 libs or the 2.5 libs when running with the -X:Python25 command line option.

W/ v1.1 w/o -X:Python25 I get:

SyntaxError: future feature is not defined: with_statement (F:\Product\Merlin\External\Languages\IronPython20\25\Lib\calendar.py, line 8)

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of edfialk
Sent: Monday, April 23, 2007 1:32 PM
To: users at lists.ironpython.com
Subject: [IronPython] script for seconds in given month, year

Hello, I'm looking for a way to provide month and year, and return the
number of seconds in that month.  My range will be roughly from
01/01/1960 to 12/31/2000 for now.

I originally thought we would be working with regular Python and asked
in the Python group, to which I got a great, working Python script:

import calendar

def seconds_in_month(month, year):
    nomatter, daysinmonth = calendar.monthrange(year, month)
    return daysinmonth * 24 * 60 * 60

Unfortunately, in IronPython the calendar module does not import:
SyntaxError: unexpected token TimeEncoding (c:\Python25\Lib
\calendar.py, line 510)

So, does anyone happen to know of a script that could perform this in

Any help would be greatly appreciated.

users mailing list
users at lists.ironpython.com

More information about the Ironpython-users mailing list