0
Traceback (most recent call last):
  File "C:/Python31/sample.py", line 10, in <module>
    calendar.prcal(year)
AttributeError: 'module' object has no attribute 'prcal'

Hello, I just started learning Python with this fantastic site. Unfortunatly I get this when i try to execute the following code

import calendar
 
print( "Show a given year's monthly calendars ..." )
print('')
# Python3 uses input() instead of raw_input()
year = int(input("Enter the year (eg. 2005): "))
print('')
[B]calendar.prcal(year)[/B]
print('')
input("Press Enter to go on ...")  # wait
# with Pytho3 use ...
#input("Press Enter to go on ...")  # wait

The bold part is what is giving me an issue.
I switched my version with 3.1 and tried it again and this still happens. What am I missing?

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by fur8ar
1

It's strange, it works on my machine with python 3.1. A possibility is that you have a file calendar.py in your directory or in the python path which hides the standard module calendar. If this is so, you should rename this file. To see if this is the case, try this

import calendar
print(calendar)

and post the output here.

Edited by Gribouillis: n/a

0

OK, I get it now. yes, I had a file called calendar.py. actually, that was its file name. Thanks for the help.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.