PDA

View Full Version : re: Calendar


nige777
06-02-2010, 05:03 PM
Quick question about the standard python calendar module - seems it works great in the interactive input window, but when using it in a script - whatever function of calendar I try to use throws a Traceback (most recent call last):
File "<string>", line 11, in ?
File "calendar.py", line 2, in ?
import calendar
File "calendar.py", line 5, in ?
print calendar.month(2010,6)
AttributeError: 'module' object has no attribute 'month' - type of error - however confusingly (for me :D) month, and its attributes was suggested by vizard & this exact same line will be happily accepted through the interactive window and prints out a calendar for June 2010? Am I missing something really silly here??
My code is VERY simple - import viz
import calendar
viz.go()

print calendar.month(2010,6)

Any help would be appreciated :D

farshizzo
06-02-2010, 05:08 PM
You probably created a file called calendar.py in your script directory, which is overriding the built-in calendar module. Rename the file and it should work.

nige777
06-03-2010, 03:13 AM
Ha ha, I knew it would be something really silly :D - working late at night again!!

Thanks farshi