[Tutor] Calendar module

Kent Johnson kent37 at tds.net
Wed Mar 30 20:36:03 CEST 2005


John Carmona wrote:
> Hi guys, I have typed this programme from the Josh Cogliati manual
> 
> -------------------------------------------------------------
> import calendar
> 
> year = input("Type in the year number: ")
> calendar.prcal(year)
> 
> 
> I get this error message
> 
> Traceback (most recent call last):
>  File "C:/Python24/Example/cal.py", line 1, in -toplevel-
>    import calendar
>  File "C:\Python24\Example\calendar.py", line 4, in -toplevel-
>    calendar.prcal(year)
> AttributeError: 'module' object has no attribute 'prcal'
> ----------------------------------------------------------------
> 
> And for some reason it does not work. I saved it as cal.py and it is 
> running from the same folder that hold Python 2.4 (I run XP)
> 
> any reason why it is not working (I managed to make it work at my 
> workplace by the way.

Because you have a file named calendar.py in the Example directory (look at the stack trace). This 
file is hiding the library calendar file.

Kent

> 
> JC
> 
> 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
> 



More information about the Tutor mailing list