Re: [Tutor] Error while using calendar module in Python 2.7

2011-03-05 Thread Alan Gauld
"Steven D'Aprano" wrote File "C:\Python27\Foursoft\calendar.py", line 33, in What's "Foursoft"? I would say that the standard library calendar module is being shadowed Ah, good catch. I didn't notice the path was non standard. Alan G ___

Re: [Tutor] Error while using calendar module in Python 2.7

2011-03-05 Thread Steven D'Aprano
Alan Gauld wrote: "ranjan das" wrote Error: Traceback (most recent call last): File "C:\Python27\Foursoft\calendar.py", line 33, in while friday.weekday() != calendar.FRIDAY: AttributeError: 'module' object has no attribute 'FRIDAY' The obvious solution is that calendar has changed be

Re: [Tutor] Error while using calendar module in Python 2.7

2011-03-05 Thread Steven D'Aprano
ranjan das wrote: I ran the following code in python 2.6 and then in python 2.7 (using calendar module) to manipulate dates and times The following code works fine in Python 2.6 but throws up an error in Python 2.7. Can anyone please say why? No it does not work fine at all. It generates a Syn

Re: [Tutor] Error while using calendar module in Python 2.7

2011-03-05 Thread Alan Gauld
"ranjan das" wrote The following code works fine in Python 2.6 but throws up an error in Python 2.7. Can anyone please say why? import datetime import calendar while monday.weekday() != calendar.MONDAY: where does 'monday' come from? Can you send a minimal example that could actually run

Re: [Tutor] Error while using calendar module in Python 2.7

2011-03-04 Thread ranjan das
Please consider this corrected example The correctly indented code with the while loop is while monday.weekday() != calendar.MONDAY: MONDAY -= oneday oneweek = datetime.timedelta(days=7) nextweek = today + oneweek nextyear = today.replace(year=today.year+1) print "Today (year-month

Re: [Tutor] Error while using calendar module in Python 2.7

2011-03-04 Thread ranjan das
Sorry David The correctly indented code with the while loop is while friday.weekday() != calendar.MONDAY: MONDAY -= oneday oneweek = datetime.timedelta(days=7) nextweek = today + oneweek nextyear = today.replace(year=today.year+1) print "Today (year-month-day) =", today print "Most r

Re: [Tutor] Error while using calendar module in Python 2.7

2011-03-04 Thread David Hutto
>>> >>> while monday.weekday() != calendar.MONDAY: ... monday -= oneday ... oneweek = datetime.timedelta(days=7) ... nextweek = today + oneweek ... print "next week" ... Traceback (most recent call last): File "", line 1, in NameError: name 'monday' is not defined >>> This means

Re: [Tutor] Error while using calendar module in Python 2.7

2011-03-04 Thread David Hutto
Could you paste the whle code, because I get: >>> import datetime >>> import calendar >>> >>> >>> >>> while monday.weekday() != calendar.MONDAY: ... File "", line 2 ^ IndentationError: expected an indented block >>> monday -= oneday File "", line 1 monday -= oneday ^ Indentati

[Tutor] Error while using calendar module in Python 2.7

2011-03-04 Thread ranjan das
I ran the following code in python 2.6 and then in python 2.7 (using calendar module) to manipulate dates and times The following code works fine in Python 2.6 but throws up an error in Python 2.7. Can anyone please say why? CODE: import datetime import calendar while monday.weekday() != cal