"ranjan das" <ranjand2...@gmail.com> 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 that shjows the error?
This is obviously just a code fragment.

Error:
Traceback (most recent call last):
 File "C:\Python27\Foursoft\calendar.py", line 33, in <module>
   while friday.weekday() != calendar.FRIDAY:
AttributeError: 'module' object has no attribute 'FRIDAY'

The obvious solution is that calendar has changed between 2.6 and 2.7
but looking on v3.1(I don;t have 2.7 installed) it looks the same there.
Certainly the day constants are still there.

HTH,


--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to