"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
___
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
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
"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
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
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
>>>
>>> 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
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
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