Calendar Problem

Victor Subervi victorsubervi at gmail.com
Wed Nov 4 10:57:47 EST 2009


Well, you're right. That's what I initially had. My server, that I am in the
process of leaving, rejected that syntax. Lovely.
Thanks,
V

On Tue, Nov 3, 2009 at 6:56 PM, Dave Angel <davea at ieee.org> wrote:

>
>
> MichaB Klich wrote:
>
>> Dnia wtorek 03 listopada 2009 o 20:50:10 Victor Subervi napisał(a):
>>
>>
>>> Hi;
>>> I have the following:
>>>
>>> import calendar, datetime
>>>
>>> myCal =alendar.calendar(6)
>>> today =atetime.date.today()
>>> day =oday.day
>>> mo =oday.month
>>> yr =oday.year
>>> month =yCal.monthdayscalendar(yr, mo)
>>>
>>>
>>> The last line throws errors no matter how I try and tweak it. The current
>>> incarnation complains about myCal being a string. What do?
>>> TIA,
>>> Victor
>>>
>>>
>>>
>>
>> You should use
>>
>> myCal =calendar.Calendar(6)
>>
>> This creates calendar.Calendar object.
>>
>>
>>
> Right. But I wanted to tell the OP what to do with an error like this.
>
>
> You should post the actual error traceback, and tell us what version of
> Python you're using:
>
> Traceback (most recent call last):
> File "M:\Programming\Python\sources\dummy\stuff2.py", line 15, in <module>
>
> month = myCal.monthdayscalendar(yr, mo)
> AttributeError: 'str' object has no attribute 'monthdayscalendar'
>
>
> Now, since it says that myCal is a 'str' object, the next thing you should
> do is look at the value. I get an actual printable calendar for a year. So
> clearly, it's not the Calendar object you were looking for. So you need to
> change from the calendar() function to the Calendar() constructor.
>
> DaveA
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20091104/78019c29/attachment-0001.html>


More information about the Python-list mailing list