git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

datepicker fails to find firstweekday in calendar


On 2020-03-20 22:43, Rich Shepard wrote:
> I'm running Python3-3.8.2 on Slackware-14.2/x86_64 and I tried to run Miguel
> Martinez Lopez's datepicker.py (version 1.0.7) before learning how I can use
> it in my application. It fails to find the attribute in the imported
> calendar module:
> 
> $ python3 datepicker.py
> Traceback (most recent call last):
>     File "datepicker.py", line 53, in <module>
>       class Calendar(ttk.Frame):
>     File "datepicker.py", line 57, in Calendar
>       def __init__(self, master=None, year=None, month=None,
> firstweekday=calendar.MONDAY, locale=None, activebackground='#b1dcfb',
> activeforeground='black', selectbackground='#003eff',
> selectforeground='white', command=None, borderwidth=1, relief="solid",
> on_click_month_button=None):
> AttributeError: module 'calendar' has no attribute 'MONDAY'
> 
> (N.B. The above itiation is line wrapped here but not in the trace back.)
> 
> Line 53 starts the calendar class:
> 
> class Calendar(ttk.Frame):
>       datetime = calendar.datetime.datetime
>       timedelta = calendar.datetime.timedelta
> 
>       def __init__(self, master=None, year=None, month=None,
> firstweekday=calendar.MONDAY, locale=None, activebackground='#b1dcfb',
> activeforeground='black', selectbackground='#003eff',
> selectforeground='white', command=None, borderwidth=1, relief="solid",
> on_click_month_button=None):
> 
> (N.B. Local line wrapping; in the code it's all on one line.)
> 
> Since calendar is built in to Python3-3.8.2 where do I look for the source
> of the problem so I can fix it?
> 
Is there another file called "calendar.py" somewhere?

Try putting "print(calendar.__file__)" after the import in the 
datepicker module.