1

I wrote a simple calendar program that will display the calendar of the desired month but encountered a similar error?Here full error Traceback (most recent call last): File "D:\Python\calendar.py", line 1, in <module> import calendar File "D:\Python\calendar.py", line 4, in <module> print(calendar.month(year , month )) TypeError: 'int' object is not callable Here is my code

import calendar
year = int(input('Enter your year:'))
month = int(input('Enter your month:'))
print(calendar.month(year , month ))

Can you help me please?!

1
  • Do not call your source calendar.py. It shadows the Standard Library module. Commented May 10, 2021 at 14:35

1 Answer 1

1

rename your month variable it is trying to call calender and then the month the input

inp_year = int(input('Enter your year:'))
inp_month = int(input('Enter your month:'))
print(calendar.month(inp_year , inp_month ))
Sign up to request clarification or add additional context in comments.

2 Comments

Enter your year:2010 Enter your month:10 Traceback (most recent call last): File "D:\Python\calendar.py", line 1, in <module> import calendar File "D:\Python\calendar.py", line 4, in <module> print(calendar.month(inp_year , inp_month )) AttributeError: partially initialized module 'calendar' has no attribute 'month' (most likely due to a circular import) Process finished with exit code 1
you cant have your python file have the same name as any module

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.