problem with calendar

Jørgen Cederberg jorgencederberg at hotmail.com
Fri Nov 1 06:55:31 EST 2002


"Roman Suzi" <rnd at onego.ru> wrote in message news:mailman.1036148287.8559.python-list at python.org...
> 
> I have the following problem:
> 
> Python 2.2.2 (#1, Oct 18 2002, 11:40:02)
> [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-110)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import calendar
> >>> calendar.month_abbr
> <calendar._localized_month instance at 0x8164a5c>
> >>> calendar.month_abbr()
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> AttributeError: _localized_month instance has no __call__ method
> 
> What's up?

calendar.month_abbr is an instance of a _localized_month class and thus not callable because it does not have a __call__ method as the Traceback states. A dir-command reveals that it has a __getitem__ method. Example:

>>> calendar.month_abbr[1]
'Jan'

Sincerely yours 
Jorgen



> 
> Sincerely yours, Roman A.Suzi
> -- 
>  - Petrozavodsk - Karelia - Russia - mailto:rnd at onego.ru -
>  
> 
> 
> 
> 
> 
> not to mailto:aaro at onego.ru
> 
> 



More information about the Python-list mailing list