[New-bugs-announce] [issue27382] calendar module .isleap() probleam

Dyl Tuckey report at bugs.python.org
Fri Jun 24 10:52:56 EDT 2016


New submission from Dyl Tuckey:

I don't know why but whenever I try and run this code:
import calendar
import time
calendar = calendar.month(2016,6)
print ("Loading date, time, month and leap year status")
time.sleep(5)
print (calendar)
localtime = time.asctime(time.localtime(time.time()))
print (localtime)
if calendar.isleap(2016) == True:
    print("This year is a leap year")
else:
    print("This year is not a leap year")


It come up with:
Loading date, time, month and leap year status
     June 2016
Mo Tu We Th Fr Sa Su
       1  2  3  4  5
 6  7  8  9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30

Fri Jun 24 15:46:12 2016
Traceback (most recent call last):
  File "C:\Users\Dylan\Desktop\Python\Calendar.py", line 9, in <module>
    if calendar.isleap(2016) == True:
AttributeError: 'str' object has no attribute 'isleap'

And I don't know why I keep getting error messages

----------
components: IDLE
messages: 269183
nosy: Dyl Tuckey
priority: normal
severity: normal
status: open
title: calendar module .isleap() probleam
type: compile error
versions: Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27382>
_______________________________________


More information about the New-bugs-announce mailing list