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?

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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.